Published declarations import types from connect, @babel/core and @babel/traverse, whose @types packages are not dependencies
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js, typescript
- 领域
- tooling
调研方向
Start with the declaration imports in packages/metro-config/src/types.js and packages/metro/src/Server.js, then inspect the package manifests for metro-config and metro and the other declaration files named in the report. Reproduce the failure with the linked project’s npm run typecheck using skipLibCheck: false; done means the published packages type-check without the missing-declaration errors.
由索引模型根据 Issue 内容生成。
描述
Reproduction: https://github.com/YevheniiKotyrlo/metro-connect-types
A TypeScript project that depends on metro-config and type-checks it with skipLibCheck: false fails on metro's own declarations: they import types from connect, @babel/core and @babel/traverse, and no metro package depends on @types/connect, @types/babel__core or @types/babel__traverse. metro-config lists @types/connect under devDependencies only, and metro not at all.
Steps (metro 0.87.2, metro-config 0.87.2, TypeScript 6.0.3, npm 12, Node 26, Windows 11 and Ubuntu 22.04 under WSL):
npm installnpm run typecheck, which runstsc -p .over anindex.tsholdingimport type { ConfigT } from 'metro-config';, withstrict,"skipLibCheck": falseand"types": ["node"].
Expected: no error.
Seen:
node_modules/metro-babel-transformer/src/index.d.ts(18,38): error TS7016: Could not find a declaration file for module '@babel/core'. 'node_modules/@babel/core/lib/index.js' implicitly has an 'any' type.
node_modules/metro-babel-transformer/src/index.d.ts(21,36): error TS7016: Could not find a declaration file for module '@babel/core'. 'node_modules/@babel/core/lib/index.js' implicitly has an 'any' type.
node_modules/metro-config/src/types.d.ts(18,43): error TS7016: Could not find a declaration file for module 'connect'. 'node_modules/connect/index.js' implicitly has an 'any' type.
node_modules/metro-source-map/src/generateFunctionMap.d.ts(19,30): error TS7016: Could not find a declaration file for module '@babel/core'. 'node_modules/@babel/core/lib/index.js' implicitly has an 'any' type.
node_modules/metro/src/ModuleGraph/worker/collectDependencies.d.ts(18,29): error TS7016: Could not find a declaration file for module '@babel/traverse'. 'node_modules/@babel/traverse/lib/index.js' implicitly has an 'any' type.
node_modules/metro/src/Server.d.ts(26,36): error TS7016: Could not find a declaration file for module 'connect'. 'node_modules/connect/index.js' implicitly has an 'any' type.
On main (a87d864565ae34826ab2425a1f06341c16a2c515) the same holds: I ran yarn build-ts-defs and node scripts/build.js under Ubuntu, packed metro-config and metro after prepare-release, installed both packs in the same project and ran the same check, which prints the same six errors. packages/metro-config/src/types.js imports HandleFunction and Server from connect, and packages/metro/src/Server.js imports IncomingMessage from it.
An app that happens to install those @types packages, as many React Native apps do through other dependencies, never sees this; a project that depends on metro alone does.
- 主要语言
- JavaScript
- 星标
- 5.7k
- 派生
- 711
- 平均合并
- 2 天 18 小时
- 30 天内合并 PR
- 66
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react/metro 的其他 Issue
-
[metro-file-map] An error a watcher backend reports ends the server, since nothing listens for it未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
维护者通常 2 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 2 天内回复
-
难度 3/5 1-2 天 新手友好度 78/100
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
hexlet-codebattle/codebattle#2374 ·
-
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
security
难度 2/5 1-3 小时 新手友好度 62/100
Waschndolos/open-clubmanager#185 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 6 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复