I installed typescript globally ( npm install typescript -g
)
Then created a folder, ran npm --init
, then npm intall typescript --save-dev
- it installed [email protected]
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
this is the problem:
uninstall-update-remove-get-rid-off: Visual Studio outdated extensions...
or remove it from the path ...
or rename the folder to confirm the problem ... then nuke it :)
check what happens if you do:
should output
also. I'll need install typescript local to the project if
a module you depend on, depends on it
you need to use a compiler feature in "your" code
you need to use a different version than the installed globally
to init:
to compile
a 'project' (based on tsconfig.json):
where . means here
to compile 'other' project
More help