0

I'm getting this error

    Unknown compiler option 'lib'. (5023)
    Unknown compiler option 'types'. (5023)

I removed typescript from node_module didn't work used npm uninstall typescript and npm install -g typescript didn't work again used npm uninstall -g typescript npm install -g typescript didn't work again

any idea?

user4092086
  • 986
  • 3
  • 12
  • 24

4 Answers4

1

Have you checked:

  • Whatever file is launching typescript (e.g. the scripts tag of package.json)

  • The tsconfig.json file?

It sounds to me like one of them may be set up incorrectly. Is that possible?

John Lockwood
  • 3,787
  • 29
  • 27
  • "scripts": { "start": "ts-node index.ts", "postinstall": "typings install" } and tsconfig is: { "compilerOptions": { "target": "ES6", "lib": ["es6", "dom"], "types": ["reflect-metadata"], "module": "commonjs", "moduleResolution": "node", "experimentalDecorators": true, "emitDecoratorMetadata": true, "outDir": "build" }, "exclude": [ "node_modules" ] } – user4092086 Oct 05 '16 at 04:23
  • OK, now do you see the two keys "lib" and "types" that the compiler is complaining about? You need to go research the typescript compiler options, google tsconfig etc. Doesn't appear to me like they're supported. – John Lockwood Oct 05 '16 at 11:52
  • Hi guys these options are supported by TS >= 2.0 I have added a note in the installation docs to highlight this requirement https://github.com/inversify/InversifyJS/blob/master/README.md#installation – Remo H. Jansen Oct 06 '16 at 11:26
1

I have added the following to the InversifyJS docs:

Important! InversifyJS requires TypeScript >= 2.0 and the experimentalDecorators, emitDecoratorMetadata, types and lib compilation options in your tsconfig.json file.

The options types and lib are only supported by TypeScript >= 2.0.

Remo H. Jansen
  • 23,172
  • 11
  • 70
  • 93
0

I was getting the same error code using Webstorm. It turns out that I wasn't using the latest version of Webstorm, and the version I was using, used Typescript 1.8... After installing the latest Webstorm, no more issue.

noWayhome
  • 670
  • 1
  • 10
  • 16
0

Try installing the latest version of TypeScript and reloading your solution.

After editing .proj file, the tsConfig.json and a few other hopeless fixes, I simply installed Typescript (which was 2.5.2), opened the solution, and the 'Unknown Compiler Option' build errors disappeared.

James Lawruk
  • 30,112
  • 19
  • 130
  • 137