You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a) re-export @tsconfig/bases so that a user's tsconfig can, for example, "extends": "ts-node/node14/tsconfig.json"
b) in the absence of a tsconfig, check node version and use a suitable default.
This allows ts-node to handle bare scripts using modern language features. For example, bigint literals require a modern "target" option which tsc does not adopt by default. If someone tried to write a ts-node shebang script using bigint literals, it would fail to compile unless they accompanied it with a tsconfig.json.
Note: changelog below mentions CLI and programmatic flags to disable this automatic base config.
Decided that was not necessary but put an implementation in #1249
TODO
add CLI flag --skip-default-project
UPDATE decided to omit this feature until it is requested, per discord discussion below.
Users can always create a tsconfig.json to suppress default project, or specify --compiler-options to override options)
update programmatic option to match? skipDefaultProject?
If you really want ts-node to use default tsc compiler options: ts-node --skip-project --skip-default-project ./index.ts
This is verbose; the rationale is that people will rarely want to do this.
The default, ts-node ./index.ts or ts-node, will load @tsconfig/node* where it picks node10, node12, or node14 based on node runtime's major version number.
When implementing, should be sure to avoid triggering any logic that cares about the path of the tsconfig file. In other words, we don't want to affect scope, or ignore, or anything like that. We just want to get the tsconfig compilerOptions such as "target" and "lib".
* Implementation
* fix
* fix lint
* fix
* fix
* cleanup
* fallback to older @tsconfig/node* config when we detect an incompatibility with the lib or target options
* lint fix
* WIP
* Add CLI and programmatic option to disable implicit compiler options
* Remove --no-implicit-compiler-options flag and programmatic option; it is implemented in another PR
* add tests
* fix tests
* fix tests
* fix tests
This is technically 2 features in one:
a) re-export
@tsconfig/bases
so that a user's tsconfig can, for example,"extends": "ts-node/node14/tsconfig.json"
b) in the absence of a tsconfig, check node version and use a suitable default.
https://github.com/tsconfig/bases
This allows ts-node to handle bare scripts using modern language features. For example, bigint literals require a modern "target" option which tsc does not adopt by default. If someone tried to write a ts-node shebang script using bigint literals, it would fail to compile unless they accompanied it with a tsconfig.json.
Note: changelog below mentions CLI and programmatic flags to disable this automatic base config.
Decided that was not necessary but put an implementation in #1249
TODO
--skip-default-project
Users can always create a
tsconfig.json
to suppress default project, or specify--compiler-options
to override options)skipDefaultProject
?--no-implicit-project
--no-implicit-compiler-options
ts.ScriptTarget
andts.libs
to ensure they have the necessary entries. If node14 config is incompatible, try node12, then node10require('typescript').libs
entries for the node12 tsconfig, so checking libs is necessaryThe text was updated successfully, but these errors were encountered: