Matt Matt - 1 year ago 335
TypeScript Question

Typescript is giving error TS2411 on it's own Typescript module?

I've switched to using @types (as one should in Typescript 2.0). So I ran

npm i -S typescript @types/typescript
to get
running all hunky dory.

However, now when I run
on my own project with
"exclude": ["node_modules"]
, I get the following error about 20 times (for different lines of the file).

node_modules/@types/typescript/index.d.ts(1306,9): error TS2411: Property
'allowNonTsExtensions' of type 'boolean | undefined' is not assignable to
string index type 'string | number | boolean'.

My code still runs fine, but it's forcing me to check whether or not the transpiling is actually wrong, or it's just these errors. Is there a way to prevent this "error" from occuring?

*edit - The more I think about it, do I even need
in my
? Should it just be a global install?

Answer Source

1) Don't install @types/typescript. The typescript module contains everything it needs. Type definition files are already included in typescript/lib folder.

2) You should definitely have typescript installed globally, but if you want to share your project (e.g. on GitHub), you should install it also locally. People won't have problems about missing dependancies or version mismatches.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download