Incompatibility issues with the latest esbuild versions
When trying to compile a typescript project using the esbuild-preprocessor I was getting the following error
Command npx tsc
cypress.config.ts(80,17): error TS2322: Type 'import("<project>/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin' is not assignable to type 'import("<local_libraries_path>/node_modules/esbuild/lib/main").Plugin'.
Types of property 'setup' are incompatible.
After checking the log of new versions for esbuild I noticed there were recent updates, and it seems the esbuld-preprocessor is not compatible versions 0.15.17 or higher.
I found a provisional solution, updating the package.json to explicitly use a given esbuild version as follows
"devDependencies": {
"@badeball/cypress-cucumber-preprocessor": "14.0.0",
"@bahmutov/cypress-esbuild-preprocessor": "2.1.5",
"esbuild": "0.15.16"
...
}
But I'd say that this should be addressed from the project.
Sharing the complete exception stack trace.
cypress.config.ts(80,17): error TS2322: Type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").Plugin'.
Types of property 'setup' are incompatible.
Type '(build: import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<void>' is not assignable to type '(build: import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<void>'.
Types of parameters 'build' and 'build' are incompatible.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").PluginBuild' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild'.
The types of 'initialOptions.plugins' are incompatible between these types.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").Plugin[] | undefined' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin[] | undefined'.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").Plugin[]' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin[]'.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").Plugin' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin'.
Types of property 'setup' are incompatible.
Type '(build: import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<void>' is not assignable to type '(build: import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<void>'.
Types of parameters 'build' and 'build' are incompatible.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").PluginBuild'.
The types of 'esbuild.build' are incompatible between these types.
Type '{ (options: import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").BuildOptions & { write: false; }): Promise<...>; (options: import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main")....' is not assignable to type '{ (options: import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").BuildOptions & { write: false; }): Promise<import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").BuildResult & { ...; }>; (options: import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").BuildOptions & { ...'.
Types of parameters 'options' and 'options' are incompatible.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").BuildOptions & { write: false; }' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").BuildOptions & { write: false; }'.
Type 'BuildOptions & { write: false; }' is not assignable to type 'BuildOptions'.
Types of property 'plugins' are incompatible.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").Plugin[] | undefined' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin[] | undefined'.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").Plugin[]' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin[]'.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").Plugin' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin'.
Types of property 'setup' are incompatible.
Type '(build: import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<void>' is not assignable to type '(build: import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<void>'.
Types of parameters 'build' and 'build' are incompatible.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").PluginBuild'.
The types of 'esbuild.initialize' are incompatible between these types.
Type '(options: import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").InitializeOptions) => Promise<void>' is not assignable to type '(options: import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").InitializeOptions) => Promise<void>'.
Types of parameters 'options' and 'options' are incompatible.
Type 'import("/home/vsts/work/1/s/web-agent/node_modules/esbuild/lib/main").InitializeOptions' is not assignable to type 'import("/home/vsts/work/1/s/web-agent/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").InitializeOptions'.
Types of property 'wasmURL' are incompatible.
Type 'string | URL | undefined' is not assignable to type 'string | undefined'.
Type 'URL' is not assignable to type 'string'.
Any updates to this issue? I'm facing the same problem.
Having the same issue as well
FYI, release v0.17.0 of esbuild is further incompatible and the watch option is completely removed in favor of a different API.
Hi, for v0.17.0 I created a little pr: https://github.com/bahmutov/cypress-esbuild-preprocessor/pull/245
Ship it, let's go!
Hi @diegomtylop, my fix was shipped in v2.2.0.
Note, that this package from 2.2.0 on comes with a peerDependency of esbuild >= 0.17, so please also install the newest 0.17 as devDependency. Does your issue still occur in that case?