DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

TypeScript and noImplicitAny

TypeScript's tsc and ts-node (and ts-node-dev) are so partial against JavaScript (without *.d.ts). Even with declaration.d.ts with declare module 'xxx', it sometimes won't compile (or run, in case of ts-node).

There are two solutions to this,

  • // @ts-ignore above the import statement
  • "noImplicitAny": false in tsconfig.json

Just to make sure, I often run TypeScript scripts with,

npx ts-node -O '{"module":"commonjs","noImplicitAny":false}' script.ts
Enter fullscreen mode Exit fullscreen mode

TypeScript is NOT JavaScript friendly.

Top comments (0)