Skip to content
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]: Type error from @rspack/core/dist/config/zod.d.ts #6481

Open
xc2 opened this issue May 8, 2024 · 2 comments
Open

[Bug]: Type error from @rspack/core/dist/config/zod.d.ts #6481

xc2 opened this issue May 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@xc2
Copy link
Collaborator

xc2 commented May 8, 2024

System Info

  System:
    OS: macOS 14.5
    CPU: (12) arm64 Apple M2 Max
    Memory: 626.78 MB / 32.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 20.12.2 - ~/.managed/n/bin/node
    Yarn: 3.5.0 - ~/.managed/n/bin/yarn
    npm: 10.5.0 - ~/.managed/n/bin/npm
    Watchman: 2024.03.18.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 124.0.6367.119
    Firefox Developer Edition: 102.0
    Safari: 17.5

Details

> @jupyterlab/[email protected] build
> tsc

../node_modules/@rspack/core/dist/config/zod.d.ts:4538:37 - error TS2589: Type instantiation is excessively deep and possibly infinite.

4538 export declare const rspackOptions: z.ZodObject<{
                                         ~~~~~~~~~~~~~
4539     name: z.ZodOptional<z.ZodString>;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ... 
7245     bail?: boolean | undefined;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7246 }>;
     ~~

../node_modules/@rspack/core/dist/config/zod.d.ts:4538:49 - error TS2344: Type '{ name: z_ZodOptional<ZodString>; dependencies: z_ZodOptional<z_ZodArray<ZodString, "many">>; entry: z_ZodOptional<z_ZodUnion<[z_ZodUnion<...>, z_ZodFunction<...>]>>; ... 25 more ...; bail: z_ZodOptional<...>; }' does not satisfy the constraint 'ZodRawShape'.
  Property 'target' is incompatible with index signature.
    Type 'z_ZodOptional<z_ZodUnion<[z_ZodUnion<[z_ZodLiteral<false>, z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodUnion<[z_ZodEnum<["web", "webworker", "es3", "es5", "es2015", "es2016", ... 6 more .....' is not assignable to type 'ZodTypeAny'.
      The types returned by 'brand(...)' are incompatible between these types.
        Type 'ZodBranded<ZodOptional<z_ZodUnion<any>>, any>' is not assignable to type 'ZodBranded<ZodType<any, any, any>, any>'.
          Type 'ZodOptional<z_ZodUnion<any>>' is missing the following properties from type 'ZodType<any, any, any>': _type, _output, _input, _def, and 31 more.

4538 export declare const rspackOptions: z.ZodObject<{
                                                     ~
4539     name: z.ZodOptional<z.ZodString>;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ... 
6413     bail: z.ZodOptional<z.ZodBoolean>;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6414 }, "strict", z.ZodTypeAny, {
     ~


Found 2 errors in the same file, starting at: ../node_modules/@rspack/core/dist/config/zod.d.ts:4538

npm ERR! Lifecycle script `build` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: @jupyterlab/[email protected] 
npm ERR!   at location: /Users/kfll/Developer/jupyterlab/builder 

Reproduce link

No response

Reproduce Steps

importing @rspack/core in a ts project without skipLibCheck enabled.

@xc2 xc2 added bug Something isn't working pending triage The issue/PR is currently untouched. labels May 8, 2024
@chenjiahan
Copy link
Member

I found that there are more than one type errors in the Rspack dist code.

  1. clone https://github.com/chenjiahan/rspack-repro-skip-lib-check
  2. npx tsc

Rspack 0.6.4:

image

Rspack 0.5.0:

Screenshot 2024-05-09 at 11 10 57

So should we fix these errors?

@xc2
Copy link
Collaborator Author

xc2 commented May 10, 2024

#2757 Another issue of type error related to rspack's dependencies other than rspack itself.

@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants