Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Resolve NodeNext TypeScript `.js` imports to TypeScript source files

オープン 初心者向け
#100 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, typescript

調査の方向性

まず CoderMind/scripts/rpg/dep_graph.py の issue で示されている resolver と invoke-resolution の範囲から始め、続いて CoderMind/tests/test_multilingual_dep_graph.py にある拡張子なしの TypeScript invoke テストを読みます。提供された a.ts と b.ts の repro を使って NodeNext スタイルのテストを追加します。.js import が b.ts に解決され、ファイル間の import エッジと invoke エッジの両方が存在すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

In a NodeNext/ESM TypeScript repo, relative imports such as import { b } from "./b.js" (the TypeScript-mandated form) remain unresolved, so the graph misses cross-file import and invoke edges. The resolver tries only the literal path when a specifier has an extension, so ./b.js is never tried as b.ts (resolver: https://github.com/microsoft/RPG-ZeroRepo/blob/f0947723cc07fe10fb0d6b14c8aa837847f57b0d/CoderMind/scripts/rpg/dep_graph.py#L2154-L2172 and invoke resolution: https://github.com/microsoft/RPG-ZeroRepo/blob/f0947723cc07fe10fb0d6b14c8aa837847f57b0d/CoderMind/scripts/rpg/dep_graph.py#L2225-L2239).

Minimal resolver-derived repro (not run):

repo/
  tsconfig.json
  src/a.ts
  src/b.ts

tsconfig.json: {"compilerOptions":{"module":"NodeNext","moduleResolution":"NodeNext"}}
src/a.ts: import { b } from "./b.js"; export function a() { return b(); }
src/b.ts: export function b() { return 1; }

Expected: import and invoke edges from src/a.ts to src/b.ts and from src/a.ts:a to src/b.ts:b. Actual: unresolved import and no cross-file invoke edge, as derived from reading the resolver, not from a run.

Suggested change:

         if extension:
             candidates.append(raw_path)
+            if extension in {".js", ".jsx", ".mjs", ".cjs"}:
+                stem = raw_path[:-len(extension)]
+                candidates.extend(
+                    f"{stem}{ext}" for ext in (".ts", ".tsx", ".mts", ".cts")
+                )

Please add a NodeNext-style test next to the existing extensionless TypeScript invoke test (https://github.com/microsoft/RPG-ZeroRepo/blob/f0947723cc07fe10fb0d6b14c8aa837847f57b0d/CoderMind/tests/test_multilingual_dep_graph.py#L156-L199). The audit report counted 241 relative .js imports as unresolved in the inspected repo. I can open a PR with the small resolver fix and test if useful.

This issue was AI-generated at the human operator's direction and reviewed by the operator before submission.

主要言語
Python
スター
553
フォーク
42
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

microsoft/RPG-ZeroRepo のほかの issue

microsoft/RPG-ZeroRepo の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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