我使用的是Cypress 10.4.0,我使用的是打字本。测试运行良好,但我的编辑器VSCode在本例中有一个ts error,如下所示:

有什么办法解决吗?这是我的tsconfig.json:
{
"compilerOptions": {
"strict": true,
"baseUrl": "../node_modules",
"target": "es5",
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es5", "dom"],
"jsx": "react",
"types": ["cypress", "@testing-library/cypress"],
"paths": {
"@cypress/*": ["../cypress/support/*"],
"@interceptors/*": ["../cypress/interceptors/*"],
"@fixtures/*": ["../cypress/fixtures/*"]
}
},
"include": ["**/*.ts"]
}发布于 2022-09-21 17:23:47
只需将cypress-audit包含在tsconfig-json中即可
{
"compilerOptions": {
"strict": true,
"baseUrl": "../node_modules",
"target": "es5",
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es5", "dom"],
"jsx": "react",
"types": ["cypress", "@testing-library/cypress"],
"paths": {
"@cypress/*": ["../cypress/support/*"],
"@interceptors/*": ["../cypress/interceptors/*"],
"@fixtures/*": ["../cypress/fixtures/*"]
}
},
"include": ["./**/*.ts", "../node_modules/cypress-audit"] // This is missing.
}https://stackoverflow.com/questions/73804750
复制相似问题