Answer the question
In order to leave comments, you need to log in
How to change the standard for Typescript?
Installed npm install typescript in the folder. The folder contains the following files:
1) test.ts
const str:string = "Hello TS !"
console.log(str)
var str = "Hello TS !";
console.log(str);
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Recommended"
}
Answer the question
In order to leave comments, you need to log in
Compile a project, not a single file.
When you call tsc test.ts
, TS does not read tsconfig.json
, but uses the default settings.
So just call tsc
.
Or explicitly specify options on the command linetsc --target ES2020 test.ts
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question