0
votes

I'm trying to understand the various library options (lib, noLib) of the TypeScript compiler.

From the documentation (https://www.typescriptlang.org/docs/handbook/compiler-options.html) I know that:

If --lib is not specified a default list of libraries are injected. The default libraries injected are: For --target ES5: DOM,ES5,ScriptHost For --target ES6: DOM,ES6,DOM.Iterable,ScriptHost

It is also stated that the noLib option false: Do not include the default library file (lib.d.ts).

My understanding was that I would explicitly define the target and the libraries and specify the noLib option.

Why do I get an error "Option 'lib' cannot be specified with option 'noLib'.ts" when specifying both?

What is the default library file (lib.d.ts)? Is it a specific version of JavaScript? Does it have anything to do with the default target (ES3)?

1

1 Answers

0
votes

Found info here: https://microsoft.github.io/TypeScript-New-Handbook/reference/compiler-options/#lib

noLib: "Disables the automatic inclusion of any library files. If this option is set, lib is ignored." (no more reference to lib.d.ts)

lib: "Default: At a minimum ["dom"], plus more depending on target"