microsoft / TypeScript-Node-Starter

A reference example for TypeScript and Node with a detailed README describing how to use the two together.
MIT License
11.31k stars 2.77k forks source link

Unable to build - TS2300, TS2428, TS2320, TS2403, TS2314, TS2717, TS2374 and TS7006 #117

Closed muditsaurabh closed 6 years ago

muditsaurabh commented 6 years ago

Steps to reproduce -

$ yarn install $ npm run build

express-typescript-starter@0.1.0 build /Users/saurabh/workspace/salesforce-notifier npm run build-sass && npm run build-ts && npm run tslint && npm run copy-static-assets

express-typescript-starter@0.1.0 build-sass /Users/saurabh/workspace/salesforce-notifier node-sass src/public/css/main.scss dist/public/css/main.css

Rendering Complete, saving .css file... Wrote CSS to /Users/saurabh/workspace/salesforce-notifier/dist/public/css/main.css

express-typescript-starter@0.1.0 build-ts /Users/saurabh/workspace/salesforce-notifier tsc

node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(61,9): error TS2300: Duplicate identifier 'NativeBuffer'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(62,9): error TS2300: Duplicate identifier 'NativeDate'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(63,9): error TS2300: Duplicate identifier 'NativeError'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(71,14): error TS2300: Duplicate identifier 'Mongoose'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(72,8): error TS2300: Duplicate identifier 'Mongoose'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(153,9): error TS2300: Duplicate identifier 'CastError'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(174,18): error TS2300: Duplicate identifier 'ConnectionBase'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(441,9): error TS2300: Duplicate identifier 'Connection'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(457,9): error TS2300: Duplicate identifier 'ValidationError'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(466,9): error TS2300: Duplicate identifier 'Error'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(556,9): error TS2300: Duplicate identifier 'VirtualType'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(573,9): error TS2300: Duplicate identifier 'Schema'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(793,13): error TS2428: All declarations of 'HookSyncCallback' must have identical type parameters. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(797,13): error TS2428: All declarations of 'HookAsyncCallback' must have identical type parameters. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1062,13): error TS2300: Duplicate identifier 'MongooseDocument'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1063,9): error TS2300: Duplicate identifier 'MongooseDocument'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1265,11): error TS2300: Duplicate identifier 'Subdocument'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1281,11): error TS2300: Duplicate identifier 'Array'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1390,11): error TS2300: Duplicate identifier 'DocumentArray'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1419,11): error TS2300: Duplicate identifier 'Buffer'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1451,10): error TS2300: Duplicate identifier 'ObjectIdConstructor'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1459,11): error TS2300: Duplicate identifier 'Decimal128'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1465,11): error TS2300: Duplicate identifier 'Embedded'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1505,9): error TS2300: Duplicate identifier 'Query'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1506,9): error TS2300: Duplicate identifier 'DocumentQuery'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1938,9): error TS2300: Duplicate identifier 'mquery'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(1990,13): error TS2300: Duplicate identifier 'Schema'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(2238,9): error TS2300: Duplicate identifier 'Aggregate'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(2395,9): error TS2300: Duplicate identifier 'SchemaType'. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'aggregate' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'bulkWrite' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'count' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'createIndex' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'createIndexes' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'deleteMany' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'deleteOne' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'distinct' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'drop' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'dropIndex' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'dropIndexes' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'find' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'findOne' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'findOneAndDelete' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'findOneAndReplace' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'findOneAndUpdate' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'geoHaystackSearch' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'indexExists' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'indexInformation' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'indexes' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'initializeOrderedBulkOp' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'initializeUnorderedBulkOp' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'insert' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'insertMany' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'insertOne' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'isCapped' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'listIndexes' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'mapReduce' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'options' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'parallelCollectionScan' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'reIndex' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'remove' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'rename' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'replaceOne' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'save' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'stats' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'update' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'updateMany' of types 'Collection' and 'Collection' are not identical. node_modules/@types/connect-mongo/node_modules/@types/mongoose/index.d.ts(3004,13): error TS2320: Interface 'CollectionBase' cannot simultaneously extend types 'Collection' and 'Collection'. Named property 'updateOne' of types 'Collection' and 'Collection' are not identical. node_modules/@types/mongoose/index.d.ts(87,9): error TS2300: Duplicate identifier 'NativeBuffer'. node_modules/@types/mongoose/index.d.ts(88,9): error TS2300: Duplicate identifier 'NativeDate'. node_modules/@types/mongoose/index.d.ts(89,9): error TS2300: Duplicate identifier 'NativeError'. node_modules/@types/mongoose/index.d.ts(97,14): error TS2300: Duplicate identifier 'Mongoose'. node_modules/@types/mongoose/index.d.ts(98,8): error TS2300: Duplicate identifier 'Mongoose'. node_modules/@types/mongoose/index.d.ts(106,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'mongo' must be of type 'typeof "/Users/saurabh/workspace/salesforce-notifier/node_modules/@types/mongodb/index"', but here has type 'typeof "/Users/saurabh/workspace/salesforce-notifier/node_modules/@types/connect-mongo/node_modul...'. node_modules/@types/mongoose/index.d.ts(196,9): error TS2300: Duplicate identifier 'CastError'. node_modules/@types/mongoose/index.d.ts(260,18): error TS2300: Duplicate identifier 'ConnectionBase'. node_modules/@types/mongoose/index.d.ts(479,9): error TS2300: Duplicate identifier 'Connection'. node_modules/@types/mongoose/index.d.ts(495,9): error TS2300: Duplicate identifier 'ValidationError'. node_modules/@types/mongoose/index.d.ts(504,9): error TS2300: Duplicate identifier 'Error'. node_modules/@types/mongoose/index.d.ts(594,9): error TS2300: Duplicate identifier 'VirtualType'. node_modules/@types/mongoose/index.d.ts(611,9): error TS2300: Duplicate identifier 'Schema'. node_modules/@types/mongoose/index.d.ts(701,48): error TS2314: Generic type 'HookAsyncCallback' requires 1 type argument(s). node_modules/@types/mongoose/index.d.ts(702,29): error TS2314: Generic type 'HookSyncCallback' requires 1 type argument(s). node_modules/@types/mongoose/index.d.ts(762,13): error TS2428: All declarations of 'HookSyncCallback' must have identical type parameters. node_modules/@types/mongoose/index.d.ts(766,13): error TS2428: All declarations of 'HookAsyncCallback' must have identical type parameters. node_modules/@types/mongoose/index.d.ts(809,5): error TS2717: Subsequent property declarations must have the same type. Property 'strict' must be of type 'boolean | "throw"', but here has type 'boolean'. node_modules/@types/mongoose/index.d.ts(811,5): error TS2717: Subsequent property declarations must have the same type. Property 'toJSON' must be of type 'DocumentToObjectOptions', but here has type 'any'. node_modules/@types/mongoose/index.d.ts(813,5): error TS2717: Subsequent property declarations must have the same type. Property 'toObject' must be of type 'DocumentToObjectOptions', but here has type 'any'. node_modules/@types/mongoose/index.d.ts(837,5): error TS2717: Subsequent property declarations must have the same type. Property 'timestamps' must be of type 'boolean| SchemaTimestampsConfig', but here has type 'any'. node_modules/@types/mongoose/index.d.ts(844,5): error TS2374: Duplicate string index signature. node_modules/@types/mongoose/index.d.ts(922,5): error TS2717: Subsequent property declarations must have the same type. Property 'validate' must be of type 'RegExp | [RegExp, string] | ValidateFn | [ValidateFn, string] | ValidateOpts | ValidateOpts...', but here has type 'any'. node_modules/@types/mongoose/index.d.ts(972,5): error TS2374: Duplicate string index signature. node_modules/@types/mongoose/index.d.ts(990,7): error TS2717: Subsequent property declarations must have the same type. Property 'validator' must be of type 'RegExp |ValidateFn', but here has type 'Function | RegExp'. node_modules/@types/mongoose/index.d.ts(1013,13): error TS2300: Duplicate identifier 'MongooseDocument'. node_modules/@types/mongoose/index.d.ts(1014,9): error TS2300: Duplicate identifier 'MongooseDocument'. node_modules/@types/mongoose/index.d.ts(1220,11): error TS2300: Duplicate identifier 'Subdocument'. node_modules/@types/mongoose/index.d.ts(1236,11): error TS2300: Duplicate identifier 'Array'. node_modules/@types/mongoose/index.d.ts(1345,11): error TS2300: Duplicate identifier 'DocumentArray'. node_modules/@types/mongoose/index.d.ts(1374,11): error TS2300: Duplicate identifier 'Buffer'. node_modules/@types/mongoose/index.d.ts(1406,10): error TS2300: Duplicate identifier 'ObjectIdConstructor'. node_modules/@types/mongoose/index.d.ts(1414,11): error TS2300: Duplicate identifier 'Decimal128'. node_modules/@types/mongoose/index.d.ts(1420,11): error TS2300: Duplicate identifier 'Embedded'. node_modules/@types/mongoose/index.d.ts(1460,9): error TS2300: Duplicate identifier 'Query'. node_modules/@types/mongoose/index.d.ts(1461,9): error TS2300: Duplicate identifier 'DocumentQuery'. node_modules/@types/mongoose/index.d.ts(1887,9): error TS2300: Duplicate identifier 'mquery'. node_modules/@types/mongoose/index.d.ts(1939,13): error TS2300: Duplicate identifier 'Schema'. node_modules/@types/mongoose/index.d.ts(2187,9): error TS2300: Duplicate identifier 'Aggregate'. node_modules/@types/mongoose/index.d.ts(2322,9): error TS2300: Duplicate identifier 'SchemaType'. node_modules/@types/mongoose/index.d.ts(2731,5): error TS2374: Duplicate string index signature. node_modules/@types/mongoose/index.d.ts(2838,5): error TS2374: Duplicate string index signature. src/models/User.ts(56,38): error TS7006: Parameter 'next' implicitly has an 'any' type. npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! express-typescript-starter@0.1.0 build-ts: tsc npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the express-typescript-starter@0.1.0 build-ts script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/saurabh/.npm/_logs/2018-05-17T15_15_00_514Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! express-typescript-starter@0.1.0 build: npm run build-sass && npm run build-ts && npm run tslint && npm run copy-static-assets npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the express-typescript-starter@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/saurabh/.npm/_logs/2018-05-17T15_15_00_537Z-debug.log

xdrop commented 6 years ago

I had the same issue and resolved it by doing rm -rf node_modules && npm install instead of yarn install. Not sure why yarn won't work though.

joemphilips commented 6 years ago

I'm having the same problem. But in my case I want to use this starter as one of the package in my monorepo, but since I want to use yarn for other packages, and it seems impossible to use different npmClient in different packages in lerna, I'm struggling to pass yarn build without causing these error. Any clue ?

EtienneK commented 6 years ago

Yup, having the same issue. Would be great if we could use yarn.

muditsaurabh commented 6 years ago

I think it is duplicate of #90 and #55. So, I am closing this issue.