fix(dts): add .json fallback for json extension substitution#1052
Conversation
44b354b to
21a407f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8641fd368b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Match TypeScript's `tryAddingExtensions` behavior for `.json` imports: after trying `.d.json.ts`, also try the `.json` extension itself. Without this, `import "./data.json"` would only find `./data.d.json.ts` and miss the actual `./data.json` file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6b28554 to
8653df8
Compare
21a407f to
b9e95cb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/dts-typesversions-prefix #1052 +/- ##
===============================================================
Coverage ? 91.74%
===============================================================
Files ? 20
Lines ? 3987
Branches ? 0
===============================================================
Hits ? 3658
Misses ? 329
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9e95cb594
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return Some(p); | ||
| } | ||
| // TS: `extensions & Extensions.Json && tryExtension(Extension.Json)` | ||
| if let Some(p) = self.dts_try_file(base, ".json", ctx) { |
There was a problem hiding this comment.
Guard .json fallback by active extension set
This unconditional .json probe runs even when the caller intentionally excludes runtime files (for example the first node_modules pass uses priority_exts = TYPESCRIPT|DECLARATION in dts_resolve_node_modules). In that path, a package whose main points to index.json now resolves to the JSON implementation before the resolver gets to the @types lookup, which regresses declaration-priority behavior and can return runtime JSON where typings are available.
Useful? React with 👍 / 👎.
Merging this PR will improve performance by 4.02%
Performance Changes
Comparing Footnotes
|
Summary
tryAddingExtensionsbehavior for.jsonimports: after trying.d.json.ts, also try the.jsonextension itselfimport "./data.json"would only find./data.d.json.tsand miss the actual./data.jsonfileextensions & Extensions.Json && tryExtension(Extension.Json)Stacked on #1051.
🤖 Generated with Claude Code