I installed typescript globally ( npm install typescript -g
)
Then created a folder, ran npm --init
, then npm intall typescript --save-dev
- it installed typescript@2.1.4
In the folder , I create 'helloworld.ts`
var msg = 'Hello World';
console.log (msg);
ran tsc command with file option - tsc helloworld.ts
and see it compiled to helloworld.js
.
Next, I want to use tsconfig.json, so I run tsc --init
- this doesn't work, says Unknown option 'init'
i say alright, let me try adding tsconfig.json manually and add it in the folder root as below:
{
"compilerOptions": {
"target": "es5"
},
"files": [
"helloworld.ts"
]
}
and I run tsc
on command prompt, but it won't work and outputs me the syntax, example and options of how to use tsc Syntax: tsc [options] [file] ...
whats wrong?
where tsc
gives below:
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.exe
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\tsc.js
C:\Users\Kap\AppData\Roaming\npm\tsc
C:\Users\Kap\AppData\Roaming\npm\tsc.cmd