Skip to content

[Tracking]: JS -> TS refactor the remaining .js file to .ts and esm #7225

@SoonIter

Description

@SoonIter

What subject does this issue tracking?

JS -> TS

  1. refactor the remaining .js file to .ts
  2. remove all ts-expect-error
  3. use typescript rather than JSDocs
  4. It is best not to use default imports or exports, "module": "nodenext" causes dynamic imports to be double default-wrapped - e.g. { default: { default: Foo } } microsoft/TypeScript#59257
  5. aligned with webpack

#4640

### Rename to `.ts` file
- [ ] https://github.com/web-infra-dev/rspack/pull/7132
- [ ] https://github.com/web-infra-dev/rspack/pull/7136
- [x] packages/rspack/src/ModuleTypeConstants.js & packages/rspack/src/Template.js
- [x] packages/rspack/src/lib
- [x] packages/rspack/src/config
- [x] packages/rspack/src/util
- [x] packages/rspack/src/loader-runner
- [x] packages/rspack/src/builtin-plugin/css-extract/hmr
- [x] packages/rspack-dev-server/src/ansiHTML.js

Type Coverage

### Increase type coverage
- [x] src/lib/formatLocation.ts
- [x] src/logging/runtime.ts
- [x] src/util/webpack.ts
- [x] src/logging/truncateArgs.ts
- [x] src/node/nodeConsole.ts
- [x] src/builtin-plugin/EnableWasmLoadingPlugin.ts
- [x] src/builtin-plugin/EnableChunkLoadingPlugin.ts
- [x] src/util/memoize.ts
- [x] src/stats/StatsFactory.ts

---- 2024.09.21

Our main files have been completed, and on this basis, we can do some work to increase the type coverage

type coverage contribution guide is in #7225 (comment)

this issues is closed, but any pr that increases the type coverage is acceptable.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions