typescript - tsc error TS1110 node.d.ts Node.js v6.x -
when running tsc lot of errors of form
typings/node/node.d.ts(ln,col): error ts1110: type expected.
fyi: first line of node.d.ts says
// type definitions node.js v6.x
what cause these errors , how resolve them?
steps reproduce: in directory having file tsconfig.json
{ "compileroptions": { "target": "es5", "sourcemap": true, "module": "commonjs", "outdir": "." } } next, execute command tsd install body-parser --save, output:
- body-parser / body-parser -> express > express -> serve-static > serve-static -> express-serve-static-core > express-serve-static-core -> node > node -> mime > mime > running install.. > written 6 files: - body-parser/body-parser.d.ts - express-serve-static-core/express-serve-static-core.d.ts - express/express.d.ts - mime/mime.d.ts - node/node.d.ts - serve-static/serve-static.d.ts the directory has subdirectory/typings.
next command:
$ tsc typings/node/node.d.ts(87,23): error ts1110: type expected. typings/node/node.d.ts(244,57): error ts1110: type expected. typings/node/node.d.ts(245,48): error ts1110: type expected. typings/node/node.d.ts(246,50): error ts1110: type expected. typings/node/node.d.ts(247,60): error ts1110: type expected. typings/node/node.d.ts(248,45): error ts1110: type expected. typings/node/node.d.ts(249,37): error ts1110: type expected. typings/node/node.d.ts(291,57): error ts1110: type expected. typings/node/node.d.ts(292,48): error ts1110: type expected. typings/node/node.d.ts(293,50): error ts1110: type expected. typings/node/node.d.ts(294,60): error ts1110: type expected. typings/node/node.d.ts(295,45): error ts1110: type expected. typings/node/node.d.ts(496,54): error ts1110: type expected. typings/node/node.d.ts(540,57): error ts1110: type expected. typings/node/node.d.ts(541,48): error ts1110: type expected. typings/node/node.d.ts(542,50): error ts1110: type expected. typings/node/node.d.ts(543,61): error ts1110: type expected. typings/node/node.d.ts(544,65): error ts1110: type expected. typings/node/node.d.ts(545,60): error ts1110: type expected. typings/node/node.d.ts(546,45): error ts1110: type expected. typings/node/node.d.ts(547,37): error ts1110: type expected. typings/node/node.d.ts(869,35): error ts1110: type expected. typings/node/node.d.ts(1950,52): error ts1005: '=' expected. typings/node/node.d.ts(1951,76): error ts1005: '=' expected. typings/node/node.d.ts(1952,52): error ts1005: '=' expected. typings/node/node.d.ts(1952,96): error ts1005: '=' expected. typings/node/node.d.ts(1962,54): error ts1005: '=' expected. typings/node/node.d.ts(1963,74): error ts1005: '=' expected. typings/node/node.d.ts(1964,54): error ts1005: '=' expected. typings/node/node.d.ts(1964,94): error ts1005: '=' expected.
tldr;
npm install -g typescript and not
npm install -g tsc explanation:
i noticed visual studio 2015 has no issues compiling same directory of typescript files examined build log (with diagnostic verbosity under options) , found line:
c:\program files (x86)\microsoft sdks\typescript\1.8\tsc.exe --module commonjs --sourcemap --target es5 --noemitonerror --locale en-us i had been using tsc compiler installed npm install tsc --global version 1.5.3 of today, whereas 1 noted above version 1.8.9.
Comments
Post a Comment