Sonunda çözmeyi başardım!
Terminaldeki komutum:
yarn tsc main.ts && nodejs main.js
Hata mesajım:
main.ts:1:16 - error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.
1 async function main() {
~~~~
Found 2 errors.
error Command failed with exit code 2.
info Visit https:
Bunu çözmek için yaptığım şey tsconfig.json dosyasına başvurmaktı.
Tsconfig.json dosyam şu şekildeydi:
{
"compilerOptions": {
"target": "ESNext",
"lib": [
"ES2015",
"DOM"
]
}
}
Ve benim terminal
yarn tsc -p ./tsconfig.json && nodejs main.js
komutum şu şekildedir: Başka .ts dosyasını çalıştırmak istersem, şunu yapıyorum:
yarn tsc -p ./tsconfig.json && nodejs file_name.js
{ "compilerOptions": { "module": "commonjs", "target": "es5", "noImplicitAny": false, "sourceMap": false } }bu benim tsconfig.json'um Nasıl Düzenlemeliyim?