stt106 stt106 - 7 months ago 164
TypeScript Question

Typescript can't be compiled in vs code: error TS5007

I just installed vs code v1 (the latest version) and typescript v1.8.10 (latest version).
I followed the exact instruction from vs code website but can't get vs code to build the simplest typescript file though I can manually build it by running tsc command in git bash. The output from the vs code is:

error TS5007: Cannot resolve referenced file: '.'.
error TS5023: Unknown option 'p'
Use the '--help' flag to see options.

This is the my helloworld.ts file which really can't be simpler:

class Greet {
private _message : string;
constructor(message : string) {
this._message = message;
Say = () => console.log(this._message);

var g = new Greet('hello typescript!');

This is my tasks.json file:

// See
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": ["-p", "."],
"showOutput": "silent",
"problemMatcher": "$tsc"

and tsconfig.json:

"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true