[英]My Angular tsconfig does not detect my Cypress types
我的 Angular tsconfig 沒有檢測到我的 Cypress 12.3 類型。 我已經嘗試了各種方法來使它正常工作,但沒有重新開始我的 Cypress 項目(我懷疑它會起作用)。
我的代碼運行良好,但我無法解決我的 IDE 中顯示的這種情況:
目前,我的cypress/tsconfig.json
看起來像這樣:
{
"extends": "../tsconfig.spec.json",
"files": [
"../cypress/**/*.ts",
"../cypress.config.ts",
"../node_modules/cypress"
],
"compilerOptions": {
"sourceMap": false,
"types": ["cypress", "node", "jasmine-expect", "chai"]
}
}
上面的配置試圖更喜歡 jasmine expect 類型而不是 chai expect,這是我需要的。
好的,我找到了解決方案。 必須小心使用files
而不是include/exclude
:
{
"extends": "../tsconfig.spec.json",
"include": [
"**/*.ts",
"../cypress.config.ts",
"../node_modules/cypress"
],
"exclude": [
"../src/**/*.ts"
],
"compilerOptions": {
"sourceMap": false,
"types": ["cypress", "node", "jasmine-expect"]
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.