0
2.3.x以降から2.4.1への私の活字体のバージョンをアップグレードした後、私は次のようなエラーに実行しているよ:TypeScript 2.4.1用のモカタイプが壊れていますか?
ERROR in *path*/tsconfig.json
error TS2688: Cannot find type definition file for 'mocha'.
は私のプロジェクトの設定間違っているか、これらのタイピングは何とか更新する必要がありますか?タイピングは間違いなくそこに残っていますが、TypeScript 2.4で別に参照する必要がありますか?ここで
は私のpackage.jsonである:ここでは
{
"scripts": {
...
"build": "rimraf dist && npm run build:client && npm run build:server",
...
"build:client": "cross-env NODE_ENV=production webpack --config build/webpack.client.config.js --progress --hide-modules",
"build:server": "cross-env NODE_ENV=production webpack --config build/webpack.server.config.js --progress --hide-modules",
...
},
"engines": {
"node": ">=7.0",
"npm": ">=4.0"
},
"dependencies": {
...
},
"devDependencies": {
"@types/chai": "4.0.1",
"@types/express": "4.0.36",
"@types/jquery": "2.0.48",
"@types/mocha": "2.2.41",
"@types/node": "7.0.32",
...
"chai": "4.1.0",
...
"typescript": "2.4.1",
...
"vue-ts-loader": "0.0.3",
"webpack": "3.2.0",
"webpack-dev-middleware": "1.11.0",
"webpack-hot-middleware": "2.18.2",
"webpack-merge": "4.1.0",
"webpack-node-externals": "1.6.0",
"webpack-shell-plugin": "0.5.0"
}
}
は私tsconfig.jsonです:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"sourceMap": true,
"experimentalDecorators": true,
"outDir": "out/",
"allowJs": true,
"lib": [
"dom",
"es5",
"es2015.promise"
]
},
"exclude": [
"node_modules",
"dist",
"test"
]
}
[既知の問題](https://github.com/Microsoft/TypeScript/issues/16772)と表示されます – k0pernikus
ロングショット:tsconfigでタイプを設定してみてください。 mochaでは[this one](https://stackoverflow.com/a/40885903/457268)を使用していますが、空の配列を設定するだけでも十分でしょう。 – k0pernikus
タイピングを試み、typeRoots ":["/typings/"]を使用することをお勧めします:npmのタイプは古くなっています –