При встраивании @ nestjs / terminus @ 6.1.0 в наш проект nestjs тип @ nestjs / microservices не распознается:
$> tsc
node_modules/@nestjs/microservices/external/redis.interface.d.ts:2:23 - error TS2688: Cannot find type definition file for 'mocha'.
2 /// <reference types="mocha" />
~~~~~
Found 1 error.
При добавлении npm i --save-dev @ types / mocha , у меня явно возникают конфликты с Jest, который мы используем для тестирования ...
$> tsc
node_modules/@types/jest/index.d.ts:27:13 - error TS2403: Subsequent variable declarations must have the same type. Variable 'beforeEach' must be of type 'HookFunction', but here has type 'Lifecycle'.
27 declare var beforeEach: jest.Lifecycle;
...
На данный момент единственный найденный мной обходной путь - это использовать skipLibCheck в файле tsconfig.json ... не очень чистый.
Здесь dep часть моего файла package.json:
[...]
"dependencies": {
"@nestjs/common": "^6.0.5",
"@nestjs/core": "^6.0.5",
"@nestjs/mongoose": "^6.0.0",
"@nestjs/graphql": "^6.2.1",
"@nestjs/swagger": "^3.0.2",
"@nestjs/terminus": "6.1.0",
"@godaddy/terminus": "4.1.0",
"app-root-path": "^2.2.1",
"class-transformer": "^0.2.0",
"class-validator": "^0.9.1",
"codacy-coverage": "^3.1.0",
"apollo-server-express": "^2.5.0",
"graphql": "^14.3.0",
"graphql-tools": "^4.0.4",
"js-cache": "^1.0.3",
"mongoose": "^5.4.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^6.4.0",
"typescript": "^3.5.2",
"winston": "^3.2.1"
},
"devDependencies": {
"@nestjs/testing": "^5.0.0",
"@types/express": "^4.0.39",
"@types/jest": "^21.1.8",
"@types/node": "^9.3.0",
"@types/supertest": "^2.0.4",
"jest": "^21.2.1",
"nodemon": "^1.14.1",
"prettier": "^1.11.1",
"supertest": "^3.0.0",
"ts-jest": "^21.2.4",
"ts-loader": "^4.1.0",
"ts-node": "^4.1.0",
"tsconfig-paths": "^3.1.1",
"tslint": "5.3.2"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "lib",
"testRegex": ".spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "../coverage"
}
Есть идеи, как это исправить?
Спасибо!