Getting "Error: Unused file" when running test for new type definition

Getting "Error: Unused file" when running test for new type definition

我在 DefinitelyTyped project for the hyphen library. You can see it 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 来绕过这个问题,但这显然不是正确的解决方案。有人可以帮我吗?提前致谢。

我原来在 tsconfig.json:

files 选项中遗漏了 index.d.ts 条目
{
    "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.

中各自的导入来识别的