Skip to content

Update TypeScript to 6.0.3 with stable type ordering#7792

Open
Copilot wants to merge 13 commits intomainfrom
copilot/update-typescript-version
Open

Update TypeScript to 6.0.3 with stable type ordering#7792
Copilot wants to merge 13 commits intomainfrom
copilot/update-typescript-version

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

Update TypeScript to v6

Updates TypeScript to 6.0.3 across the monorepo workspaces and updates related tooling compatibility. Adds the TypeScript 6 compatibility fixes needed for type-checking, CSS side-effect imports, doc generation, and stable type ordering to support future TypeScript 6.0 to 7.0 migrations.

Changelog

New

  • Added explicit CSS module declarations for side-effect CSS imports in packages and examples.
  • Enabled TypeScript stableTypeOrdering in shared compiler options.

Changed

  • Updated TypeScript workspace dependencies to 6.0.3.
  • Updated typescript-eslint to 8.59.1 for TypeScript 6 support.
  • Added root @types/node dev dependency and explicit Node types in shared TypeScript config.
  • Updated doc-gen TypeScript config resolution to use deterministic absolute config search and fallback paths.
  • Added explicit rootDir and scoped include for the React package declaration build config.
  • Resolved merge conflicts with main, keeping the TypeScript 6 tooling updates and the newer Vitest 4.1.5-related versions from main.

Removed

  • None.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; dependency/tooling update only

Testing & Reviewing

Validated with:

  • npm run type-check
  • npm run build
  • npm run lint
  • npm run lint:css
  • npm run format:diff
  • Targeted reruns for browser test files that failed during full-suite execution:
    • npm test -- packages/react/src/TreeView/TreeView.test.tsx
    • npm test -- packages/react/src/AnchoredOverlay/AnchoredOverlay.test.tsx

Merge checklist

Copilot AI and others added 6 commits April 27, 2026 22:42
Agent-Logs-Url: https://github.com/primer/react/sessions/a15a55df-6d49-4490-a348-a8408f1765f1

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/a15a55df-6d49-4490-a348-a8408f1765f1

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/a15a55df-6d49-4490-a348-a8408f1765f1

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/a15a55df-6d49-4490-a348-a8408f1765f1

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/a15a55df-6d49-4490-a348-a8408f1765f1

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/a15a55df-6d49-4490-a348-a8408f1765f1

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

⚠️ No Changeset found

Latest commit: 3df6f88

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI requested a review from joshblack April 27, 2026 23:18
@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@github-actions github-actions Bot temporarily deployed to storybook-preview-7792 April 27, 2026 23:55 Inactive
@joshblack joshblack added skip changeset This change does not need a changelog integration-tests: skipped manually Changes in this PR do not require an integration test and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Apr 28, 2026
@joshblack joshblack marked this pull request as ready for review April 28, 2026 14:29
@joshblack joshblack requested a review from a team as a code owner April 28, 2026 14:29
Copilot AI review requested due to automatic review settings April 28, 2026 14:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the monorepo’s TypeScript toolchain to TypeScript 6.0.3 and adjusts related configuration and type declarations to keep type-checking, CSS side-effect imports, and doc generation working across workspaces.

Changes:

  • Bump TypeScript (and related tooling like typescript-eslint) to versions compatible with TS 6.
  • Add Node type support in shared TS configs and add @types/node at the repo root.
  • Add *.css module declarations for side-effect CSS imports and adjust doc-gen TS config resolution.
Show a summary per file
File Description
tsconfig.json Adds explicit Node types for root TS usage and reformats include list.
tsconfig.base.json Adds types: ["node"] to the shared compiler options.
package.json Updates TypeScript + typescript-eslint and adds @types/node dev dependency.
package-lock.json Lockfile updates reflecting TS 6 / tooling upgrades and new dependency resolutions.
packages/react/tsconfig.build.json Adds explicit rootDir for declaration-only build output.
packages/react/src/global.d.ts Adds declare module '*.css' {} to allow side-effect CSS imports.
packages/react/package.json Updates workspace TypeScript dependency to ^6.0.3.
packages/doc-gen/src/ts-utils.ts Adjusts tsconfig discovery/parse to use an absolute search dir / config path.
packages/doc-gen/package.json Updates workspace TypeScript dependency to ^6.0.3.
packages/mcp/package.json Updates workspace TypeScript dependency to ^6.0.3.
packages/postcss-preset-primer/package.json Updates workspace TypeScript dependency to ^6.0.3.
packages/rollup-plugin-import-css/package.json Updates workspace TypeScript dependency to ^6.0.3.
packages/styled-react/package.json Updates workspace TypeScript dependency to ^6.0.3.
packages/styled-react/.storybook/global.d.ts Adds *.css module declaration for Storybook side-effect CSS imports.
examples/nextjs/package.json Updates example TypeScript dependency to ^6.0.3.
examples/nextjs/global.d.ts Adds *.css module declaration for side-effect CSS imports.
examples/theming/package.json Updates example TypeScript dependency to ^6.0.3.
examples/theming/global.d.ts Adds *.css module declaration for side-effect CSS imports.
examples/codesandbox/package.json Updates example TypeScript dependency to ^6.0.3.

Copilot's findings

  • Files reviewed: 13/19 changed files
  • Comments generated: 3

Comment on lines +46 to 55
const configSearchDir = rootDir ? path.resolve(rootDir) : process.cwd()
const configPath = ts.findConfigFile(configSearchDir, ts.sys.fileExists)
const config = ts.readConfigFile(configPath ?? 'tsconfig.json', ts.sys.readFile)
const parsedConfig = ts.parseJsonConfigFileContent(
config.config,
ts.sys,
configPath ? path.dirname(configPath) : process.cwd(),
undefined,
'tsconfig.json',
configPath ?? path.join(process.cwd(), 'tsconfig.json'),
)
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

getTSProgram computes configSearchDir from rootDir, but the fallback paths still use process.cwd() (both the readConfigFile filename and the parseJsonConfigFileContent base/configFileName args). If rootDir is provided and no tsconfig is found, this will read/resolve the wrong config relative to the current working directory instead of the requested root. Use configSearchDir for the fallback (or throw when configPath is undefined) so doc-gen resolves configs deterministically.

See below for a potential fix:

  const fallbackConfigPath = path.join(configSearchDir, 'tsconfig.json')
  const config = ts.readConfigFile(configPath ?? fallbackConfigPath, ts.sys.readFile)
  const parsedConfig = ts.parseJsonConfigFileContent(
    config.config,
    ts.sys,
    configPath ? path.dirname(configPath) : configSearchDir,
    undefined,
    configPath ?? fallbackConfigPath,

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 0a431f5 by resolving the fallback tsconfig path and parse base from configSearchDir instead of process.cwd().

Comment thread packages/react/tsconfig.build.json
Comment thread package.json
Comment on lines +95 to +96
"typescript": "^6.0.3",
"typescript-eslint": "^8.59.1",
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

typescript-eslint@8.59.1 declares a Node engine requirement (>=18.18.0 / >=20.9.0 / >=21.1.0). Since this repo’s root package.json still advertises a much lower Node engine, installing with older Node versions will produce engine warnings/failures. Consider updating the repo’s documented/declared Node engine range to match the new tooling requirements.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

@copilot can you add support for the --stableTypeOrdering flag to help with 6.0 -> 7.0 migrations

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI and others added 2 commits April 28, 2026 14:58
Agent-Logs-Url: https://github.com/primer/react/sessions/4ca05341-a404-4579-8d24-8c084938d197

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Agent-Logs-Url: https://github.com/primer/react/sessions/b75b5f39-2273-4b97-942b-33291bcfdd06

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
@github-actions github-actions Bot temporarily deployed to storybook-preview-7792 April 28, 2026 15:03 Inactive
@joshblack joshblack requested a review from francinelucca April 28, 2026 15:04
Copilot AI changed the title Update TypeScript to 6.0.3 Update TypeScript tooling and doc-gen config resolution Apr 28, 2026
Copilot AI requested a review from joshblack April 28, 2026 15:05
Agent-Logs-Url: https://github.com/primer/react/sessions/b75b5f39-2273-4b97-942b-33291bcfdd06

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

@copilot can you add support for the --stableTypeOrdering flag to help with 6.0 -> 7.0 migrations

Added stableTypeOrdering to the shared TypeScript compiler options in 6b0e4e8, and validated with type-check, build, tests, lint, CSS lint, format check, and final code review/security validation.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD les/.bin/node get --local ode-gyp-bin/sh node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Update TypeScript tooling and doc-gen config resolution Update TypeScript to 6.0.3 with stable type ordering Apr 28, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7792 April 28, 2026 15:14 Inactive
@joshblack
Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Agent-Logs-Url: https://github.com/primer/react/sessions/f4d835bb-e8b4-4459-a1e2-06c8716f84c8

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 28, 2026

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts in 94dcef8 by merging main and keeping the TypeScript 6/tooling updates alongside the newer Vitest versions from main.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • example.com
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD tsc (dns block)
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1194/chrome-linux/headless_shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AcceptCHFrame,AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Translate,AutoDeElevate,RenderD ckages/react/node_modules/.bin/node (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Co-authored-by: joshblack <3901764+joshblack@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants