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

Resolver type from webpack/enhanced-resolve are not compatible #18150

Closed
latin-1 opened this issue Mar 4, 2024 · 3 comments · Fixed by #18154
Closed

Resolver type from webpack/enhanced-resolve are not compatible #18150

latin-1 opened this issue Mar 4, 2024 · 3 comments · Fixed by #18154

Comments

@latin-1
Copy link

latin-1 commented Mar 4, 2024

Bug report

TS2322, might be another bug in https://github.com/webpack/tooling?

What is the current behavior?

Type 'Plugin' is not assignable to type 'false | "" | 0 | ResolvePluginInstance | "..." | null | undefined'.
  Type '{ apply: (arg0: Resolver) => void; }' is not assignable to type 'false | "" | 0 | ResolvePluginInstance | "..." | null | undefined'.
    Type '{ apply: (arg0: Resolver) => void; }' is not assignable to type 'ResolvePluginInstance'.
      Types of property 'apply' are incompatible.
        Type '(arg0: Resolver) => void' is not assignable to type '(resolver: Resolver) => void'.
          Types of parameters 'arg0' and 'resolver' are incompatible.
            Type 'import("/private/tmp/test/node_modules/webpack/types").Resolver' is not assignable to type 'import("/private/tmp/test/node_modules/enhanced-resolve/types").Resolver'.
              The types of 'options.plugins' are incompatible between these types.
                Type 'Plugin[]' is not assignable to type 'import("/private/tmp/test/node_modules/enhanced-resolve/types").Plugin[]'.
                  Type 'Plugin' is not assignable to type 'import("/private/tmp/test/node_modules/enhanced-resolve/types").Plugin'.
                    Type '{ apply: (arg0: Resolver) => void; }' is not assignable to type 'Plugin'.
                      Type '{ apply: (arg0: import("/private/tmp/test/node_modules/webpack/types").Resolver) => void; }' is not assignable to type '{ apply: (arg0: import("/private/tmp/test/node_modules/enhanced-resolve/types").Resolver) => void; }'.
                        Types of property 'apply' are incompatible.
                          Type '(arg0: import("/private/tmp/test/node_modules/webpack/types").Resolver) => void' is not assignable to type '(arg0: import("/private/tmp/test/node_modules/enhanced-resolve/types").Resolver) => void'.
                            Types of parameters 'arg0' and 'arg0' are incompatible.
                              Type 'import("/private/tmp/test/node_modules/enhanced-resolve/types").Resolver' is not assignable to type 'import("/private/tmp/test/node_modules/webpack/types").Resolver'.
                                The types of 'options.plugins' are incompatible between these types.
                                  Type 'import("/private/tmp/test/node_modules/enhanced-resolve/types").Plugin[]' is not assignable to type 'Plugin[]'.
                                    Type 'import("/private/tmp/test/node_modules/enhanced-resolve/types").Plugin' is not assignable to type 'Plugin'.
                                      Type '{ apply: (arg0: Resolver) => void; }' is not assignable to type 'Plugin'.

If the current behavior is a bug, please provide the steps to reproduce.

declare const resolvePlugin: import('enhanced-resolve').Plugin;

const webpackConfig: import('webpack').Configuration = {
  resolve: { plugins: [resolvePlugin] },
};

What is the expected behavior?

There should be no type errors.

Other relevant information:

Package Version
webpack 5.90.3
enhanced-resolve 5.15.1
typescript 5.3.3
@alexander-akait
Copy link
Member

hm, I see, WIP

@alexander-akait
Copy link
Member

hm, can you run npm ls enhanced-resolve? I found the only one problem

  • ((this: Resolver, arg1: Resolver) => void) exists in enhanced-resolve, but doesn't support by webpack

Based on your message, you have different enhanced-resolve version, so Resolver is incompatibility between versions

@alexander-akait
Copy link
Member

Oh, I see the other problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants