Dependencies: Upgrade TypeScript to 6.0.3#34971
Conversation
Bump TypeScript ^5.9.3 -> ^6.0.3 across the workspace (devDependencies + root resolutions). Published frameworks' peer/runtime ranges are widened (... || ^6.0.0) so TypeScript 5 consumers keep working. Supporting toolchain bumps for TS 6.0 compatibility: - @typescript-eslint/* 8.48 -> 8.60 - svelte-check 4.3 -> 4.4.8, svelte2tsx 0.7.44 -> 0.7.55 Fixes for TS 6.0 type-check changes: - base tsconfig: noUncheckedSideEffectImports:false (bundler-resolved CSS side-effect imports), ignoreDeprecations "5.0" -> "6.0" (baseUrl) - core: declare deep ESM entrypoints of react-syntax-highlighter - react: access optional jest global via globalThis - nextjs-vite: type the vite-plugin export at source, drop the now-conflicting module augmentation Angular sandbox runtime is intentionally out of scope: TS 6.0 requires @angular/compiler-cli >= 21.2 (repo is on 19.1); tracked as a follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis pull request upgrades Storybook's TypeScript version to 6.0 across the monorepo, updates TS config for 6.0 deprecations and side-effect imports, suppresses untyped deep ESM imports from react-syntax-highlighter, refactors Jest global access in the React renderer, restructures Next.js Vite plugin typing, and reformats package-manager method signatures. ChangesTypeScript 6.0 Upgrade
🎯 2 (Simple) | ⏱️ ~12 minutes Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@code/frameworks/angular/package.json`:
- Line 86: The package.json peerDependencies currently advertises "typescript"
^6.0.3 which incorrectly allows TS 6.x; update the peerDependencies.typescript
entry in package.json to restrict TypeScript to the range compatible with
Angular 19.1 (for example ">=5.5.0 <5.8.0") so it no longer includes 6.x; locate
the peerDependencies block and change the typescript constraint accordingly
(ensure consistency with any references to `@angular/compiler-cli` or Angular 19.1
compatibility notes).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 54246d86-9aab-411e-a7cc-b8c8ab860b58
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (48)
code/addons/a11y/package.jsoncode/addons/docs/package.jsoncode/addons/links/package.jsoncode/addons/onboarding/package.jsoncode/addons/pseudo-states/package.jsoncode/addons/themes/package.jsoncode/addons/vitest/package.jsoncode/builders/builder-webpack5/package.jsoncode/core/package.jsoncode/core/src/components/components/syntaxhighlighter/syntaxhighlighter.tsxcode/core/src/typings.d.tscode/frameworks/angular/package.jsoncode/frameworks/ember/package.jsoncode/frameworks/html-vite/package.jsoncode/frameworks/nextjs-vite/package.jsoncode/frameworks/nextjs-vite/src/index.tscode/frameworks/nextjs-vite/src/vite-plugin/index.tscode/frameworks/nextjs/package.jsoncode/frameworks/preact-vite/package.jsoncode/frameworks/react-native-web-vite/package.jsoncode/frameworks/react-vite/package.jsoncode/frameworks/server-webpack5/package.jsoncode/frameworks/svelte-vite/package.jsoncode/frameworks/sveltekit/package.jsoncode/frameworks/tanstack-react/package.jsoncode/frameworks/vue3-vite/package.jsoncode/frameworks/web-components-vite/package.jsoncode/lib/cli-storybook/package.jsoncode/lib/codemod/package.jsoncode/lib/core-webpack/package.jsoncode/lib/create-storybook/package.jsoncode/lib/csf-plugin/package.jsoncode/lib/eslint-plugin/package.jsoncode/lib/react-dom-shim/package.jsoncode/package.jsoncode/presets/create-react-app/package.jsoncode/presets/react-webpack/package.jsoncode/presets/server-webpack/package.jsoncode/renderers/html/package.jsoncode/renderers/preact/package.jsoncode/renderers/react/src/entry-preview.tsxcode/renderers/server/package.jsoncode/renderers/svelte/package.jsoncode/renderers/vue3/package.jsoncode/renderers/web-components/package.jsoncode/tsconfig.jsonpackage.jsonscripts/package.json
💤 Files with no reviewable changes (2)
- code/core/src/components/components/syntaxhighlighter/syntaxhighlighter.tsx
- code/frameworks/nextjs-vite/src/index.ts
| "empathic": "^2.0.0", | ||
| "rimraf": "^6.0.1", | ||
| "typescript": "^5.9.3", | ||
| "typescript": "^6.0.3", |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
For @angular/compiler-cli 19.1.x, what TypeScript versions are officially supported? Is TypeScript ^6.0.0 supported?
💡 Result:
For @angular/compiler-cli version 19.1.x, the officially supported TypeScript versions are >=5.5.0 and <5.8.0 [1][2]. TypeScript ^6.0.0 is not supported by Angular 19.1.x [1][2]. Support for TypeScript 6.0.0 was introduced in later versions of the Angular framework [3].
Citations:
- 1: https://angular.dev/reference/versions
- 2: https://marmo.dev/angular-typescript-node
- 3: feat(core): add support for TypeScript 6 angular/angular#67038
Fix Angular 19.1 peerDependencies to avoid advertising unsupported TypeScript 6
Line 104 widens peerDependencies.typescript to include ^6.0.0, but Angular 19.1.x (@angular/compiler-cli) officially supports TypeScript >=5.5.0 and <5.8.0; TS 6.x is not supported. Keep the peer capped to TS 5.x (e.g., <5.8.0) until the Angular toolchain supports TypeScript 6.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@code/frameworks/angular/package.json` at line 86, The package.json
peerDependencies currently advertises "typescript" ^6.0.3 which incorrectly
allows TS 6.x; update the peerDependencies.typescript entry in package.json to
restrict TypeScript to the range compatible with Angular 19.1 (for example
">=5.5.0 <5.8.0") so it no longer includes 6.x; locate the peerDependencies
block and change the typescript constraint accordingly (ensure consistency with
any references to `@angular/compiler-cli` or Angular 19.1 compatibility notes).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The production build (compile:production) surfaced issues the noEmit type-check did not: - js-package-manager proxies (NPM/PNPM/BUN): annotate getResolutions with the abstract contract's `Record<string, any>` return type, so declaration emit no longer leaks the un-nameable `PackageJson.DependencyOverrides` namespace type (TS4053) once rollup-plugin-dts renames the bundled PackageJson type. - react-syntax-highlighter: TS 6.0 no longer falls back to @types/react-syntax-highlighter for the deep ESM entrypoints, so: - suppress the now-untyped imports with @ts-expect-error (type-check), and - mark react-syntax-highlighter as types-external so rollup-plugin-dts stops walking its CJS source (which fails on refractor/core and exhausts the heap). It stays bundled in the JS output, like ast-types. Verified: nx check (43 projects) and nx compile -c production (42 projects) both green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 72 | 72 | 0 |
| Self size | 20.39 MB | 20.38 MB | 🎉 -16 KB 🎉 |
| Dependency size | 36.11 MB | 36.11 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 203 | 203 | 0 |
| Self size | 908 KB | 908 KB | 🚨 +144 B 🚨 |
| Dependency size | 88.58 MB | 88.57 MB | 🎉 -16 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 196 | 196 | 0 |
| Self size | 32 KB | 32 KB | 0 B |
| Dependency size | 87.07 MB | 87.05 MB | 🎉 -16 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 73 | 73 | 0 |
| Self size | 1.08 MB | 1.08 MB | 0 B |
| Dependency size | 56.50 MB | 56.49 MB | 🎉 -16 KB 🎉 |
| Bundle Size Analyzer | node | node |
….0.0 svelte-vite and vue3-vite ship `typescript` as a runtime dependency (for docgen). Widening the range to include ^6.0.0 made Yarn resolve typescript@6.0.3 (highest in range) when these packages are portaled into the TS-5 test-storybooks, conflicting with their typescript@5.9.x at link time (YN0071) and failing the portable-stories CI jobs. The monorepo build is unaffected — the root `resolutions` pin forces typescript@6.0.3 regardless of the declared range — so revert these two ranges to their previous values to keep the published contract identical and let TS-5 consumers dedupe as before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What I did
Upgrades the repository to TypeScript 6.0.3 (latest).
typescript^5.9.3→^6.0.3across the workspace (alldevDependenciesplus the rootresolutionspin that forces a single TS version). Published frameworks' peer/runtime ranges (@storybook/angular,@storybook/svelte-vite,@storybook/vue3-vite) were widened (… || ^6.0.0) rather than hard-pinned, so downstream TypeScript 5 consumers keep working.@typescript-eslint/*8.48→8.60,svelte-check4.3→4.4.8,svelte2tsx0.7.44→0.7.55.code/tsconfig.json—noUncheckedSideEffectImports: false(Storybook intentionally relies on bundler-resolvedimport './x.css'side-effect imports, whichtsccan't resolve) andignoreDeprecations: "5.0"→"6.0"(silences the newbaseUrldeprecation, which also brokevue-tsc).react-syntax-highlighter(@types/react-syntax-highlighterdoesn't cover them) and removed two now-redundant@ts-expect-errordirectives.jestglobal viaglobalThis(its ambient value is no longer in scope under 6.0)../vite-pluginexport at its source and dropped thedeclare moduleaugmentation that now conflicts with TS 6.0's self-referencing module resolution.Verification (all green locally)
yarn nx run-many -t check— 43 projects, incl.vue-tsc+svelte-checkyarn nx run-many -t compile— all packagesyarn lint— full repo (typescript-eslint8.60 +eslint-plugin-storybook)eslint-pluginunit tests (rule-tester)Out of scope (follow-up)
TypeScript 6.0 is incompatible with the Angular toolchain currently pinned here:
@angular/compiler-clionly permits TS 6.0 from ≥ 21.2, and this repo is on 19.1.@storybook/angular's own source type-checks fine under TS 6.0, but compiling Angular sandboxes (ng build) will hit Angular's hardMAX_TS_VERSIONguard until Angular is bumped two majors (19 → 21). That upgrade is intentionally deferred — it overlaps in-flightangular-vitework.test-storybooks/*fixtures were also left on their pinned TS versions (standalone test repos, not part of the workspace type-check).Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
In addition to unit tests, the primary signal for a TypeScript upgrade is the repo's own
check(full-monorepotsc) andlintCI — both pass.Manual testing
This is a toolchain/dependency upgrade with no runtime behavior change — TypeScript types are erased by the esbuild-based build, so the produced JS is unchanged. It is exercised entirely by CI (
check,lint, unit tests), all green locally. To verify manually:yarn && yarn nx run-many -t check→ 0 type errors across all 43 projects.cd code && yarn lint→ 0 errors.yarn task --task sandbox --start-from auto --template react-vite/default-tsand confirm Storybook starts/renders.Documentation
MIGRATION.MD
No user-facing API changes; no docs/migration update required.
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
dependencies(applied)Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>🤖 Generated with Claude Code
Summary by CodeRabbit