It seems the TypeScript compiler always includes lib.d.ts or lib.es6.d.ts (depending on the compiler target).
In our application we have a WebSocket class that is already defined in lib.d.ts. We're running our application under Node.js and not in a web browser, so we actually don't need all of the definitions from lib.d.ts. Instead lib.core.d.ts would be sufficient for us (and would solve the WebSocket conflict of course).
Is it possible to tell the TypeScript compiler which global type definition file to use?
Use --noLib compiler option to exclude lib.d.ts and then add reference to lib.core.d.ts in your source files.
Equivalent for tsconfig.json would be "noLib": true.
If you only need Node.js definitions, you can also use the Definitely Typed one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With