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

Typescript warnings in cypress config #9

Closed
dschulten opened this issue Jan 8, 2025 · 4 comments
Closed

Typescript warnings in cypress config #9

dschulten opened this issue Jan 8, 2025 · 4 comments
Labels
enhancement New feature or request released

Comments

@dschulten
Copy link

dschulten commented Jan 8, 2025

ESLint complains about several Typescript issues in cypress.config.ts.

import fix from "cypress-on-fix"; // Could not find a declaration file for module cypress-on-fix.

Subsequently there are warnings about assignments, calls and arguments of type any.

Could we provide type descriptions so that npm i --save-dev @types/cypress-on-fix might be used to fix these warnings? Better ideas?

Workaround: add cypress-on-fix.d.ts:

export = onProxy;
/**
 * @param {Cypress.PluginEvents} on
 */
declare function onProxy(on: Cypress.PluginEvents): (eventName: string, callback: any) => any;

and adjust the call to fixedOn in cypress.config.ts:

      fixedOn("file:preprocessor", async (file: Cypress.FileObject) => {
        syncFeatureFile(file);

Still not great because there are still explicit any declarations, but at least the warnings in the cypress config go away.

@bahmutov
Copy link
Owner

bahmutov commented Jan 9, 2025

I would prefer to include types in this package, rather than having a separate @types/cypress-on-fix

@bahmutov bahmutov added the enhancement New feature or request label Jan 9, 2025
@keulenIT
Copy link

export = onProxy;
/**

  • @param {Cypress.PluginEvents} on
    */
    declare function onProxy(on: Cypress.PluginEvents): (eventName: string, callback: any) => any;

Hi there, running into the same issue. How does your import statement look in your config.ts following this change? With this change I still get the error.

@csvtuda
Copy link

csvtuda commented Jan 24, 2025

Isn't PR #7 more or less exactly what you would prefer to see, @bahmutov?

Copy link

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

4 participants