bahmutov / bahmutov/cypress-esbuild-preprocessor
Incompatibility issues with the latest esbuild versions
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 83
- Forks
- 13
- Avg merge
- 12h 21m
- Merged PRs (30d)
- 2
Description
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'.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the TypeScript error with npx tsc, then inspect package.json and the esbuild usage in cypress.config.ts. Compare the project’s dependency versions and determine the compatibility boundary; done means the project compiles without the incompatible Plugin and PluginBuild type errors using a supported esbuild version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cypress, javascript, typescript
- Domain
- build-system, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100