Skip to content

fix: use untransformed typescript type exports#261

Merged
danielroe merged 4 commits intomainfrom
fix/ts-exports
Apr 27, 2026
Merged

fix: use untransformed typescript type exports#261
danielroe merged 4 commits intomainfrom
fix/ts-exports

Conversation

@danielroe
Copy link
Copy Markdown
Member

@danielroe danielroe commented Feb 13, 2026

spotted that rollup has difficulty with named exports from typescript, but this syntax seems to work

this is the error we get:

Error: s/nuxt-module build: [error] Error building /tmp/workspace/storybook/storybook/packages/nuxt-module: RollupError: "CompilerOptions" is not exported by "../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/typescript.d.ts", imported by "../../node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.d.mts".
Error: s/nuxt-module build: [error] "CompilerOptions" is not exported by "../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/typescript.d.ts", imported by "../../node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.d.mts".
https://github.com/nuxt/ecosystem-ci/actions/runs/21975826177/job/63530864522

if it seems off to you in any way, please feel free to ignore! 🙏

Summary by CodeRabbit

  • Refactor

    • Updated internal TypeScript type references to a consistent namespace-qualified form for improved maintainability and consistency.
  • Chores

    • Adjusted build configuration to use explicit bundle entries and treat TypeScript as an external dependency for more predictable bundling.

@danielroe danielroe requested a review from pi0 February 13, 2026 18:09
Comment thread typescript.d.mts Outdated
@@ -0,0 +1,3 @@
import type ts from "typescript";
Copy link
Copy Markdown
Member

@pi0 pi0 Feb 16, 2026

Choose a reason for hiding this comment

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

Could we instead, uptate src/tsconfig to do non named import?

Testing this, it remains as-is in dist/.dts

import type * as ts from "typescript";

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done ✅

@danielroe danielroe requested a review from pi0 March 10, 2026 11:29
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 10, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Refactors TypeScript type imports in src/tsconfig/types.ts to use a ts namespace and updates the TSConfig interface accordingly; adjusts build.config.ts to change entries from string list to object-based entries and marks typescript as external in bundle options.

Changes

Cohort / File(s) Summary
TS types namespace
src/tsconfig/types.ts
Replaced direct TypeScript imports with import * as ts from 'typescript'. Updated TSConfig.compilerOptions to StripEnums<ts.CompilerOptions> and TSConfig.typeAcquisition to ts.TypeAcquisition.
Build config entries & bundling
build.config.ts
Converted entries from string array to object-based array with explicit bundle entry for src/index.ts. Added bundler options marking typescript as external to influence bundle generation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A hop for types, a namespace delight,
I bundled ts in the soft twilight,
Entries reshaped, externals set true,
Code sniffs the spring — fresh, neat, and new! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating TypeScript type references to use namespace-qualified imports (ts.CompilerOptions, ts.TypeAcquisition) to ensure untransformed TypeScript type exports, which directly addresses the Rollup build error described in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ts-exports

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@danielroe danielroe merged commit e171c62 into main Apr 27, 2026
4 of 5 checks passed
@danielroe danielroe deleted the fix/ts-exports branch April 27, 2026 10:16
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.

2 participants