Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#100 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, typescript

Direzione di ricerca

Inizia in CoderMind/scripts/rpg/dep_graph.py, negli intervalli di risoluzione del resolver e di invoke-resolution citati nella issue, quindi leggi il test di invoke TypeScript senza estensione in CoderMind/tests/test_multilingual_dep_graph.py. Aggiungi un test in stile NodeNext usando il repro fornito con a.ts e b.ts; il lavoro è completato quando l’import .js viene risolto in b.ts e sono presenti sia l’arco di import tra file sia l’arco di invoke.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
553
Fork
43
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/RPG-ZeroRepo

Tutte le issue di microsoft/RPG-ZeroRepo

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.