I installed typescript globally ( npm install typescript -g
)
Then created a folder, launched npm --init
, then npm intall typescript --save-dev
- installed typescript @ 2.1.4
In the folder I create 'helloworld.ts`
var msg = 'Hello World'; console.log (msg);
launched the tsc command with the file option - tsc helloworld.ts
and saw that it was compiled in helloworld.js
.
Next, I want to use tsconfig.json, so I run tsc --init
- this does not work, says the Unknown option 'init'
I say, well, let me try adding tsconfig.json manually and add it to the root of the folder, as shown below:
{ "compilerOptions": { "target": "es5" }, "files": [ "helloworld.ts" ] }
and I run tsc
on the command line, but it will not work and displays me the syntax, example and parameters of how to use tsc Syntax: tsc [options] [file] ...
What's wrong?
where tsc
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
source share