npm i -g typescript
touch tsconfig.json
tsc --init
- tsconfig.json code:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"watch": true,
"lib": ["DOM", "ES2017"],
"outDir": "./build",
"rootDir": "./src"
}
}
Run this command in the root directory where sec and build are present and make sure your typescript file is in src folder.
tsc