Skip to content

chore: upgrade to TypeScript 6 - #11347

Open
erwanMarmelab wants to merge 15 commits into
nextfrom
feat/typescript-v7/main
Open

erwanMarmelab wants to merge 15 commits into
nextfrom
feat/typescript-v7/main

Conversation

@erwanMarmelab

@erwanMarmelab erwanMarmelab commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

TypeScript v6 is out, but RA is still on TypeScript v5.

Solution

Upgrade to TypeScript v6.

We deliberately choose not to upgrade to TypeScript V7 because the entire toolchain (eslint, VSCode) isn't yet ready to support it out of the box.

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

@erwanMarmelab erwanMarmelab added the WIP Work In Progress label Aug 26, 2026
@erwanMarmelab erwanMarmelab changed the title chore: upgrade to TypeScript 7 chore: upgrade to TypeScript 6 Aug 27, 2026
@erwanMarmelab erwanMarmelab added RFR Ready For Review and removed WIP Work In Progress labels Aug 28, 2026
@fzaninotto

Copy link
Copy Markdown
Member

needs rebase...

Comment thread .github/workflows/test.yml Outdated
Comment thread examples/simple/tsconfig.json
Comment thread examples/simple/tsconfig.json Outdated
Comment thread packages/ra-ui-materialui/src/field/RichTextField.tsx Outdated
Comment thread tsconfig.json Outdated
/* Basic Options */
"target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"module": "esnext" /* Specify module code generation. zshy overrides this per output format (commonjs for .cjs, esnext for .js). */,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why does this need changing if zshy overrides it?

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.

You're right, it doesn't. Reverted to commonjs (and moduleResolution back to node)n build, typecheck and the full test suite pass. The jest module: 'commonjs' override is gone too

Comment thread tsconfig.json Outdated
Comment thread yarn.lock Outdated
linkType: hard

"@rollup/pluginutils@npm:^5.0.1, @rollup/pluginutils@npm:^5.0.2, @rollup/pluginutils@npm:^5.3.0":
"@rollup/pluginutils@npm:^5.0.1, @rollup/pluginutils@npm:^5.3.0":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand this change

@erwanMarmelab erwanMarmelab Sep 17, 2026 •

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.

Leftover from rollup-preserve-directives, which this PR added to demo/crm but nothing imports. Removed, the lockfile entry is gone.

Comment thread yarn.lock Outdated
languageName: node
linkType: hard

"react-dom@npm:^19.0.0":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand this changes, which leads to a duplicate react in the repo

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.

Lockfile drift from a stale install. Regenerated from the branch baseline: the diff is now only typescript, typescript-eslint, ts-jest and their transitive deps. No duplicate react.

Comment thread yarn.lock Outdated
Comment thread yarn.lock
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A>=3 < 6#optional!builtin<compat/typescript>":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

so we still bundle typescript 5?

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.

Only under node_modules/lerna/node_modules/typescript, lerna hard-depends on typescript@>=3 <6. The workspace root is 6.0.3. Same situation on next, except lerna shared the hoisted TS 5 there.

@fzaninotto

Copy link
Copy Markdown
Member

needs rebase

erwanMarmelab and others added 3 commits September 17, 2026 15:37
The merge of next into this branch resolved the lockfile conflict in
favor of next, dropping the entries for the upgraded typescript,
ts-jest, typescript-eslint and @types/node. Every CI job then failed at
the install step with YN0028 ("the lockfile would have been modified by
this install").
@erwanMarmelab
erwanMarmelab force-pushed the feat/typescript-v7/main branch from 42ad953 to 8e1f6ed Compare September 17, 2026 14:34
Comment thread .vscode/settings.json Outdated
Comment thread packages/ra-data-graphql-simple/src/buildVariables.ts Outdated
Comment thread package.json Outdated
- Drop the .vscode/settings.json added by mistake.
- Keep unmatched nested filters in buildVariables instead of dropping
  them: the list query would have run unfiltered while the UI still
  showed the filter as active, with no error. This matches what the
  non-nested branch already does for filters that are not resource
  fields.
- Restore the root typecheck script to CI=true lerna run build. Packages
  resolve cross-package imports through dist/*.d.ts, which lerna run
  typecheck never builds, so it failed with TS2307 on a fresh clone and
  checked against stale declarations otherwise. The per-package
  typecheck scripts stay, they are useful inside a single package.
@pysnooLab

Copy link
Copy Markdown
Contributor

Nit (non-blocking): with TS 6 defaulting types to [], the root tsconfig.json now only lists "node". Jest globals (describe, it, expect, jest) still type-check in spec files, but only indirectly: examples/crm/src/setupTests.js imports @testing-library/jest-dom (picked up thanks to allowJs and no include), whose typings reference jest, which pulls @types/jest into the whole program.

If that file is removed or stops importing jest-dom, every spec file in the repo will lose its jest types in the editor. Suggest making it explicit:

"types": ["node", "jest"]

@fzaninotto fzaninotto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Partial review only

Comment thread examples/simple/src/comments/CommentEdit.tsx Outdated
Comment thread examples/simple/src/comments/CommentEdit.tsx Outdated
Comment thread examples/simple/src/comments/PostQuickCreate.tsx Outdated
Comment thread examples/simple/src/comments/PostQuickCreate.tsx Outdated
Comment thread examples/simple/src/posts/PostList.tsx Outdated
Comment thread examples/simple/src/users/UserList.tsx Outdated
Comment thread examples/simple/tsconfig.json Outdated
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true,
"ignoreDeprecations": "6.0",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this necessary since it uses TypeScript 6?

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.

It wasn't needed: it only silenced the TS 6 deprecation warnings for baseUrl and moduleResolution: "node". I removed baseUrl, which wasn't used, and switched to moduleResolution: "bundler".

Comment thread packages/create-react-admin/src/app.tsx Outdated
Comment thread packages/create-react-admin/src/app.tsx Outdated
Comment thread packages/ra-core/src/controller/button/useDeleteController.tsx Outdated

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFR Ready For Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants