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

包packages/cli下yarn tsc WebpackDevServer错误类型“Compiler”的参数不能赋给类型“Compiler | MultiCompiler”的参数。 #75

Open
ahange opened this issue Sep 16, 2021 · 0 comments

Comments

@ahange
Copy link

ahange commented Sep 16, 2021

src/commands/dev.ts:106:42 - error TS2345: Argument of type 'Compiler' is not assignable to parameter of type 'Compiler | MultiCompiler'.
Type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").Compiler' is not assignable to type 'import("/home/hange/work/ovine/node_modules/@types/webpack/index").Compiler'.
The types of 'hooks.shouldEmit.taps' are incompatible between these types.
Type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>[]' is not assignable to type 'import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>[]'.
Type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>' is not assignable to type 'import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>'.
Types of property 'fn' are incompatible.
Type '((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => void) | ((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => a...' is not assignable to type '((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => void) | ((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => any) | ((arg1: import("/hom...'.
Type '(arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => void' is not assignable to type '((arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => void) | ((arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => any) | ((arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => Promise<...>)'.
Type '(arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => void' is not assignable to type '(arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => void'.
Types of parameters 'arg1' and 'arg1' are incompatible.
Type 'import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation' is not assignable to type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation'.
The types of 'hooks.record.taps' are incompatible between these types.
Type 'import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index"...' is not assignable to type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...'.
Type 'import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index"...' is not assignable to type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...'.
Types of property 'fn' are incompatible.
Type '((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => void) | ((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilati...' is not assignable to type '((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => void) | ((arg1: import("/home/hange/work/ovine/packages/cli/node_m...'.
Type '(arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => void' is not assignable to type '((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => void) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => Promise<...>)'.
Type '(arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => void' is not assignable to type '(arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => void'.
Types of parameters 'arg1' and 'arg1' are incompatible.
Type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation' is not assignable to type 'import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation'.
The types of 'hooks.record.taps' are incompatible between these types.
Type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...' is not assignable to type 'import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index"...'.
Type 'import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...' is not assignable to type 'import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index"...'.
Types of property 'fn' are incompatible.
Type '((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => void) | ((arg1: import("/home/hange/work/ovine/packages/cli/node_m...' is not assignable to type '((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => void) | ((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilati...'.
Type '(arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => void' is not assignable to type '((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => void) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => Promise<...>)'.

106 const devServer = new WebpackDevServer(compiler, devServerConfig)
~~~~~~~~

Found 1 error.

类型“Compiler”的参数不能赋给类型“Compiler | MultiCompiler”的参数。
不能将类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").Compiler”分配给类型“import("/home/hange/work/ovine/node_modules/@types/webpack/index").Compiler”。
在这些类型中,"hooks.shouldEmit.taps" 的类型不兼容。
不能将类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>[]”分配给类型“import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>[]”。
不能将类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>”分配给类型“import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, any, any, any>”。
属性“fn”的类型不兼容。
不能将类型“((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => any) | ((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => vo...”分配给类型“((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => any) | ((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => void) | ((arg1: import("/hom...”。
不能将类型“(arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => any”分配给类型“((arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => any) | ((arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => void) | ((arg1: Compilation, arg2: any, arg3: any, ...args: any[]) => Promise<...>)”。
不能将类型“(arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => any”分配给类型“(arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: any, arg3: any, ...args: any[]) => any”。
参数“arg1”和“arg1” 的类型不兼容。
不能将类型“import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation”分配给类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation”。
在这些类型中,"hooks.record.taps" 的类型不兼容。
不能将类型“import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation...”分配给类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...”。
不能将类型“import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation...”分配给类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...”。
属性“fn”的类型不兼容。
不能将类型“((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").comp...”分配给类型“((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: import("/home/hange/work/ovine/packages/cli/n...”。
不能将类型“(arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => undefined”分配给类型“((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => void) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => Promise<...>)”。
不能将类型“(arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => undefined”分配给类型“(arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => undefined”。
参数“arg1”和“arg1” 的类型不兼容。
不能将类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation”分配给类型“import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation”。
在这些类型中,"hooks.record.taps" 的类型不兼容。
不能将类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...”分配给类型“import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation...”。
不能将类型“import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/packages/cli/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/packages...”分配给类型“import("/home/hange/work/ovine/node_modules/@types/tapable/index").Tap<import("/home/hange/work/ovine/node_modules/@types/tapable/index").TapType, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation...”。
属性“fn”的类型不兼容。
不能将类型“((arg1: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/packages/cli/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: import("/home/hange/work/ovine/packages/cli/n...”分配给类型“((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Compilation, arg2: import("/home/hange/work/ovine/node_modules/@types/webpack/index").compilation.Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: import("/home/hange/work/ovine/node_modules/@types/webpack/index").comp...”。
不能将类型“(arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => undefined”分配给类型“((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => undefined) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => void) | ((arg1: Compilation, arg2: Record[], arg3: any, ...args: any[]) => Promise<...>)”。ts(2345)
const compiler: webpack.Compiler
没有可用的快速修复

error Command failed with exit code 2.

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

No branches or pull requests

1 participant