rspack
rspack copied to clipboard
remove all @ts-expect-error
https://github.com/web-infra-dev/rspack/pull/3863 introduces lots of //@ts-expect-error as workaround to enable typecheck test, but we should fix and remove all of it
I would like to crush all the type errors in the code(call me TS error crusher). Would you like to assign this to me?
There are pretty many of them so would you think that curating a list first would be a better approach?
Thanks!
I would like to crush all the type errors in the code(call me TS error crusher). Would you like to assign this to me?
There are pretty many of them so would you think that curating a list first would be a better approach?
Thanks!
Yes, type gymnastics is back!
Let me first recap the current status of ts-error usage in the repo.
Overview
At the moment, more specifically eea9d067073930c350c5ad95f5c1ad89d6c6d424, rspack has 302 ts-expect-errors.
| Package Name | ts-expect-error Count |
|---|---|
| packages/rspack-cli | 19 |
| packages/rspack-dev-server | 41 |
| packages/rspack-plugin-html | 18 |
| packages/rspack-plugin-react-refresh | 3 |
| packages/rspack | 211 |
| scripts | 1 |
| webpack-test | 9 |
Rspack core packages breakdown
Since rspack core packages itself has many ts-expect-error, a breakdown will be helpful to make every pull request change small and manageable.
| Package Name | ts-expect-error Count |
|---|---|
| src | 53 |
| src/builtin-loader | 1 |
| src/config | 10 |
| src/lib | 29 |
| src/loader-runner | 25 |
| src/logging | 9 |
| src/node | 14 |
| src/stats | 18 |
| src/util | 50 |
| test | 2 |
Strategy
Type errors are nasty to see in codebase but should not impact runtime behavior. To minimize the impact of fixing type error, changes will be split into small, standalone pull request and every change will aim at being type-level only.
Progress Tracking
- [x] packages/rspack-cli
- [ ] packages/rspack-dev-server
- [x] packages/rspack-plugin-html
- [ ] packages/rspack-plugin-react-refresh
- [x] scripts
- [ ] webpack-test
- [ ] packages/rspack
- [ ] src
- [ ] src/builtin-loader
- [ ] src/config
- [ ] src/lib
- [ ] src/loader-runner
- [ ] src/logging
- [ ] src/node
- [ ] src/stats
- [ ] src/util
- [ ] test
Please remember not modify any tsconfig during refactor, because it's easy to be broken like https://github.com/web-infra-dev/rspack/pull/4650
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
@SoonIter is this finished?
@SoonIter is this finished?
not all but most of them, there are still several parts
- packages/rspack/loader-runner/index.js
- packages/rspack/src/stats/DefaultStatsFactoryPlugin.ts
- packages/rspack/src/MultiCompiler.ts
- packages/rspack/src/Watching.ts
- rspack-dev-server (cannot be removed because of private API)
and some one or two small pieces