Resolve NodeNext TypeScript `.js` imports to TypeScript source files
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python, typescript
- Domain
- developer-experience, tooling
Research direction
Start in CoderMind/scripts/rpg/dep_graph.py at the resolver and invoke-resolution ranges cited in the issue, then read the extensionless TypeScript invoke test in CoderMind/tests/test_multilingual_dep_graph.py. Add a NodeNext-style test using the provided a.ts and b.ts repro; done means the .js import resolves to b.ts and both cross-file import and invoke edges are present.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 553
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/RPG-ZeroRepo
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
microsoft/RPG-ZeroRepo#101 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
microsoft/RPG-ZeroRepo#5 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
microsoft/RPG-ZeroRepo#3 · 2 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
microsoft/RPG-ZeroRepo#2 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 1/100
microsoft/RPG-ZeroRepo#1 · 7 comments ·
All issues in microsoft/RPG-ZeroRepo
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Deltares/imod-python#1940 ·
Maintainers usually reply within 1 day
-
effort: low prio: low ready
Difficulty 1/5 Under an hour Newbie friendliness 82/100
digitalfabrik/integreat-cms#4621 ·
Maintainers usually reply within 5 days
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ioos/compliance-checker#1375 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
netbox status: backlog topic: testing type: housekeeping
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
netbox-community/netbox#23395 ·
Maintainers usually reply within 1 day