Установил npm install typescript в папке. Папка содержит такие файлы :
1) test.ts
const str:string = "Hello TS !"
console.log(str)
2)test.js
var str = "Hello TS !";
console.log(str);
3) tsconfig.json
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Recommended"
}
4) node_modules
test.js был скомпилирован с test.ts через команду "tsc test.ts"
Вопрос , почему переменная str определена через var ? Как сделать так что б она была const