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
{{ message }}
Repository navigation
Re-export node-relevant @tsconfig/bases; use by default in absence of a tsconfig file #1202
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".
Activity
cspotcode commentedon Feb 12, 2021
Will need to add an option
--skip-default-projectIf you really want
ts-nodeto use default tsc compiler options:ts-node --skip-project --skip-default-project ./index.tsThis is verbose; the rationale is that people will rarely want to do this.
The default,
ts-node ./index.tsorts-node, will load @tsconfig/node* where it picks node10, node12, or node14 based on node runtime's major version number.cspotcode commentedon Feb 12, 2021
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".
Implement #1202: default @tsconfig/bases (#1236)