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
intsconfig.json
Just to make sure, I often run TypeScript scripts with,
npx ts-node -O '{"module":"commonjs","noImplicitAny":false}' script.ts
TypeScript is NOT JavaScript friendly.
Top comments (0)