Published declarations import types from connect, @babel/core and @babel/traverse, whose @types packages are not dependencies

オープン
#2,135 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
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):

  1. npm install
  2. npm run typecheck, which runs tsc -p . over an index.ts holding import type { ConfigT } from 'metro-config';, with strict, "skipLibCheck": false and "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時間
マージ済み PR(30日)
66

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

react/metro のほかの issue

react/metro の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。