typescript - 运行新类型定义的测试时出现“错误:未使用的文件”
问题描述
我在DefinitelyTyped项目中为连字符库创建了一个新的类型定义。你可以在这里看到它。
但是,在运行测试脚本时,npm run test hyphen
我收到以下错误消息:
C:\MyProjects\code\ts-d.ts\DefinitelyTyped>npm run test hyphen
> definitely-typed@0.0.3 test C:\MyProjects\code\ts-d.ts\DefinitelyTyped
> node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed "hyphen"
Clean data
Clean logs
Clean output
Using local Definitely Typed at C:\MyProjects\code\ts-d.ts\DefinitelyTyped.
Parsing definitions...
Found 6695 packages.
Parsing in parallel...
Error: Unused file C:\MyProjects\code\ts-d.ts\DefinitelyTyped/types/hyphen/index.d.ts (used files: ["patterns/de-1996.d.ts","patterns/hu.d.ts","en-gb.d.ts","hyphen-tests.ts","common.ts","tsconfig.json","tslint.json"])
at checkAllUsedRecur (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\lib\definition-parser.js:368:23)
at checkAllFilesUsed (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\lib\definition-parser.js:331:5)
at getTypingDataForSingleTypesVersion (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\lib\definition-parser.js:142:5)
at combineDataForAllTypesVersions (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\lib\definition-parser.js:96:25)
at Object.getTypingInfo (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\lib\definition-parser.js:27:82)
at C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\lib\definition-parser-worker.js:17:50
at Object.logUncaughtErrors (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\util\util.js:78:38)
at process.<anonymous> (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\lib\definition-parser-worker.js:15:16)
at process.emit (events.js:210:5)
at emit (internal/child_process.js:876:12)
Error: Parsing failed.
at fail (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\util\util.js:272:20)
at ChildProcess.<anonymous> (C:\MyProjects\code\ts-d.ts\DefinitelyTyped\node_modules\types-publisher\bin\util\util.js:261:21)
at ChildProcess.emit (events.js:210:5)
at finish (internal/child_process.js:861:14)
at processTicksAndRejections (internal/process/task_queues.js:75:11)
错误说这index.d.ts
是一个未使用的文件。但这不是真的,因为它在我的hyphen-tests.ts文件中使用。
我可以添加index.d.ts
以OTHER_FILES.txt
绕过问题,但这显然不是正确的解决方案。有人可以帮我吗?提前致谢。
解决方案
我发现我错过了我的选项中的index.d.ts
条目:files
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"strict": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"types": []
},
"files": [
"index.d.ts",
"hyphen-tests.ts"
]
}
但我仍然不知道为什么它必须在那里,因为所有其他.d.ts
文件都是通过它们各自在hyphen-tests.ts
.
推荐阅读
- ruby-on-rails - Capistrano 未设置环境变量 AWS EC2
- database - Clarification on First Normal Form
- c++ - !heap -l 的巨大差异导致调试和发布版本之间的 Windbg
- angular - 区分 Observables、Subjects、ReplaySubjects、Behavior Subjects?
- algorithm - 到达目的地的最短停留时间
- php - 将登录会话用户名/用户 ID 存储在本地存储中,然后在页面之间传递它是否安全?
- r - 给定数据框中的这两列,如何在 R 中使用“最小”函数?
- java - 在一个线程中定期发送许多 UDP 数据报有时会导致微包突发
- kotlin - Kotlin:使用 buildString 修复重载解析歧义
- python - 从标签中的条目中添加并获取浮点数的总和