Closed lengors closed 11 months ago
Found the problem. Since ts-node
gets installed with @types/node
, by not explicitily defining the compilerOptions.types
property in the tsconfig.json
, TypeScript automatically uses all packages in @types
as packages to be included without being referenced in the source file and since @types/node
has types from multiple JavaScript language versions, than those get automatically available even if we define an older version as taget. By explicitily setting the compilerOptions.types
property, the issue goes away.
Search Terms
Expected Behavior
Typescript transpile behavior should not be modified when running the typescript compiler, but it is. As an example, if I set
target
compiler option of thetypescript
toES5
and use some functionality fromSymbol
s, the compiler will fail to compile if I do not havets-node
installed, but if I do it compiles succesfully.Actual Behavior
Typescript compiler behavior should not change with
ts-node
installed. If I want to target a different language version forts-node
the option should be set ints-node
object inside thetsconfig.json
file, but not change the behavior of the typescript compiler.Steps to reproduce the problem
tsconfig.json
filetarget
option toES5
,include
to["src"]
andoutDir
to./dist
Symbol
)Minimal reproduction
https://github.com/lengors/ts-node-repro
Specifications