-
-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: TypeScript errors TS2416 and TS2694 in @rspack/core
#8277
Comments
Use ReturnType<> to avoid explicitly naming the types of builtin iterators that have changed in 5.6, and convert manually implemented iterators to generators so they are compatible with builtin iterators under --target ESNext. Fixes part of web-infra-dev#8277. Signed-off-by: Anders Kaseorg <[email protected]>
Use ReturnType<> to avoid explicitly naming the types of builtin iterators that have changed in 5.6, and convert manually implemented iterators to generators so they are compatible with builtin iterators under --target ESNext. Fixes part of web-infra-dev#8277. Signed-off-by: Anders Kaseorg <[email protected]>
@GiveMe-A-Name , after #8279 , there is still a type error of zod, but "我不会了" node_modules/@rspack/core/dist/config/zod.d.ts:2751:48 - error TS2694: Namespace 'z' has no exported member 'objectUtil'.
2751 asset: z.ZodOptional<z.ZodObject<z.objectUtil.extendShape<{
~~~~~~~~~~
Found 5 errors in 2 files.
Errors Files
4 node_modules/@rspack/core/dist/Compilation.d.ts:399
1 node_modules/@rspack/core/dist/config/zod.d.ts:2751 |
a workaround to avoid this type error, is to set |
The @@ -1,6 +1,6 @@
import type { JsAssetInfo } from "@rspack/binding";
import type * as webpackDevServer from "webpack-dev-server";
-import { z } from "../../compiled/zod";
+import { z } from "zod";
import { Chunk } from "../Chunk";
import type { Compilation, PathData } from "../Compilation";
import { Module } from "../Module"; |
…8279) fix(type): Make iterators compatible with TS 5.6 --target ESNext Use ReturnType<> to avoid explicitly naming the types of builtin iterators that have changed in 5.6, and convert manually implemented iterators to generators so they are compatible with builtin iterators under --target ESNext. Fixes part of #8277. Signed-off-by: Anders Kaseorg <[email protected]>
Ah, the problem is that prebundle generated (via rollup-plugin-dts here): declare const z_objectUtil: typeof objectUtil; which declares an object that contains the value members ( |
I opened an upstream rollup-plugin-dts issue and fix: |
Swatinem/rollup-plugin-dts#323 Fixes web-infra-dev#8277. Signed-off-by: Anders Kaseorg <[email protected]>
System Info
Details
I get many TypeScript errors just from doing
import "@rspack/core"
in a TypeScript file.(The first four are new with TypeScript 5.6, the last is not.)
Reproduce link
No response
Reproduce Steps
From an empty directory:
The text was updated successfully, but these errors were encountered: