Skip to content

fix: preserve moduleResolution from parsed tsconfig (#52) + dep upgrades#58

Open
steven-pribilinskiy wants to merge 2 commits intomainfrom
fix/issue-52-moduleresolution-stripped
Open

fix: preserve moduleResolution from parsed tsconfig (#52) + dep upgrades#58
steven-pribilinskiy wants to merge 2 commits intomainfrom
fix/issue-52-moduleresolution-stripped

Conversation

@steven-pribilinskiy
Copy link
Copy Markdown
Collaborator

Summary

  • Fix TS >= 5.4.0 types generation problem #52: TS >= 5.4 generates any for all imported types. The destructure on compileTypes.ts:27 dropped moduleResolution from the parsed config; with module: "ES2022" and no moduleResolution, TypeScript falls back to Classic resolution and can't resolve react, third-party packages, or path aliases. Now we only strip the legacy raw-string variant returned by the require()-based loader.
  • Bump dependencies to latest, including major versions: biome 1 -> 2 (config migrated), vitest 2 -> 4, typescript 5.6 -> 6.0, @types/node 22 -> 25, webpack 5.95 -> 5.106.
  • Webpack _options -> options: webpack >= 5.100 renamed ModuleFederationPlugin#_options to #options. The plugin now reads options first and falls back to _options for older webpack versions.
  • TS 6.0 fixes: added ignoreDeprecations: "6.0" and explicit rootDir; tightened Compiler hook callback typings in the plugin test.
  • Vitest 4 fix: deep auto-mocks no longer propagate through barrel re-exports, so the plugin test now mocks the barrel directly with importActual.

Test plan

  • Verify with reporter's repro repo (vertozyp/TS-types-generation) that generated .d.ts no longer contains any for imported types
  • Smoke-test in an MFE on TS 5.6 / 5.7 / 6.0 with module: "ES2022", moduleResolution: "Node"
  • Confirm webpack 5.95 (legacy _options) still works against the installed plugin
  • CI green

Copy link
Copy Markdown

@unblocked unblocked Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found.

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions about your code.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

Comment thread src/compileTypes/compileTypes.ts
@steven-pribilinskiy steven-pribilinskiy force-pushed the fix/issue-52-moduleresolution-stripped branch from c12b533 to 490d0c8 Compare April 30, 2026 19:02
The TS >= 5.4 loader returns `moduleResolution` as a `ModuleResolutionKind`
enum value; stripping it during the destructure forced the program back to
Classic resolution, which couldn't find imported modules and emitted every
referenced type as `any`. Only strip the legacy raw-string variant.

Also fix the version detection: the previous regex
/^[5-9]\.([4-9]|[1-9]\d)/ only matched X.4 and above within each major,
so TS 6.0-6.3 fell through to the legacy require()-based loader and would
have reproduced the same bug. Switch to a numeric major/minor comparison.

Closes #52
- @biomejs/biome 1.9 → 2.4 (config migrated)
- @types/node 22 → 24
- @vitest/coverage-istanbul 2 → 4
- typescript 5.6 → 6.0 (added ignoreDeprecations + rootDir)
- vitest 2 → 4
- webpack 5.95 → 5.106
- simple-git-hooks, tsx bumped to latest

Adapt to webpack's rename of ModuleFederationPlugin#_options to #options
(introduced around 5.100), with fallback to the legacy field. Update the
plugin test to mock the barrel export, which vitest 4 no longer collapses
through deep auto-mocks. Tighten Compiler hook callback typings for TS 6.
@steven-pribilinskiy steven-pribilinskiy force-pushed the fix/issue-52-moduleresolution-stripped branch from 490d0c8 to 4ff43fe Compare April 30, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS >= 5.4.0 types generation problem

1 participant