rusackas opened a new pull request, #45603:
URL: https://github.com/apache/superset/pull/45603
### SUMMARY
TypeScript 7 (the native compiler) for `superset-frontend`. The embedded SDK
and websocket packages already moved in #43702 and #43703; this does the main
app. Measured locally on a clean install, same commands the lint-frontend "tsc"
step and the pre-commit type check run:
| phase | TypeScript 6.0.3 | TypeScript 7.0.2 |
|---|---|---|
| `npm run plugins:build` | 38 s | 27 s |
| `npm run type` (full `tsc --noEmit`) | 31 s | 7 s |
The CI step is dominated by those two plus the `npm i` inside the container,
so I'd expect the 163-second "tsc" step on lint-frontend to roughly halve; the
run on this PR is the real number and I'll note it here.
TypeScript 7's package no longer ships the JavaScript compiler API
(`require('typescript').createProgram` is undefined), which is what
dependabot's #45297 ran into indirectly. Two things in the repo used that API:
- The webpack dev server's `fork-ts-checker-webpack-plugin`, which is
dropped along with the `DISABLE_TS_CHECKER` knob. docker-compose already
defaulted that knob to `true`, so the compose dev flow doesn't change; for a
bare `npm run dev`, type errors now come from `npm run type` (or `npm run type
-- --watch`, fast on TS7) and package `.d.ts` output from `npm run
plugins:build`. The webpack config comment and UPDATING.md say so.
- Storybook's `reactDocgen: 'react-docgen-typescript'`, switched to
`react-docgen`, Storybook's Babel-based default. Prop tables still come from
the TypeScript source; Chromatic and the story tests on this PR are the check
that nothing regressed.
`typescript-json-schema` and `postcss-styled-syntax` also use the API but
pin their own nested TypeScript, so they're unaffected. An npm `overrides`
block to give the two consumers a nested TypeScript 6 didn't work for peer
dependencies, and an aliased `typescript-6` package hijacks the `tsc` bin link,
so removing the two consumers was the clean route.
Two source fixes were needed. TypeScript 7 infers a union of promise types
for a `.then` callback that returns different promises per branch, so
`ComparisonRangeLabel`'s callback is now `async`. And declaration emit of
`Object.assign(CustomModal, {...})` leaked the non-exported `CustomModal` into
every story that references `Modal` (TS4082), so `Modal` gets an explicit type.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
### TESTING INSTRUCTIONS
`cd superset-frontend && npm ci && npm run plugins:build && npm run type`
passes with 0 errors. `npm run build-storybook` and `npm run test-storybook`
exercise the docgen change; CI's chromatic and test-storybook jobs run both.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [x] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]