ここにある優れた Express/Node/Typescript サンプル コードを使用しています。run.sh から次のコマンドを使用して、.ts コードをトランスパイルします。
./node_modules/.bin/tsc --sourcemap --module commonjs ./bin/www.ts
これは宣伝どおりに機能しますが、tsconfig.json ファイルを使用することをお勧めしますtsc -p .。ただし、そのコマンドを実行するとTS2300: Duplicate identifier 'foo' errors、tsc(誤って?) ./node_modulesand./typingsディレクトリをウォークしようとすると、大量のエラーが発生します。以下は、私が使用している tsconfig.json です。
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings"
]
}
何か案は?tsc 1.7.3 FWIW を使用しています。