【发布时间】:2020-08-02 04:13:03
【问题描述】:
我在DefinitelyTyped 项目中为hyphen 库创建了一个新的类型定义。你可以看到它here。
但是在运行测试脚本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 以绕过该问题,但这显然不是正确的解决方案。有人可以帮我吗?提前致谢。
【问题讨论】:
标签: typescript definitelytyped .d.ts