Reputation: 2289
My project compiles fine, but if I checkout in a new directory and try npm install
then webpack
, I get the following errors:
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(500,12): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(502,12): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(504,15): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(505,15): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(506,15): error TS1005: ',' expected.
ERROR in /home/nobody/myproject/server/node_modules/@types/mongodb/index.d.ts
(1002,23): error TS1005: ',' expected.
and about 25 other errors in the same file, as well as other errors in some of my source files.
In my tsconfig.json
I exclude node_modules
, and I also have webpack externals
set for packaging node_modules
with a node express backend:
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function (mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
What I don't really get is why everything works fine in my development directory, but if I put it in another one, it breaks.
Upvotes: 0
Views: 1563
Reputation: 23483
What version of TypeScript are you using? The current version of Mongo's .d.ts
files started using default type arguments, which were released in TypeScript 2.3. There are also something like 20+ default type arguments in the file, which sounds like the number of parse errors you're seeing.
In short, you might need to just upgrade to TypeScript 2.3.
Upvotes: 2