You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The recommended way of adding typings support (import 'cypress-file-upload';) clashes with the user's typings for their custom commands.
// in support/commands.ts/// <reference types="cypress" />import'cypress-file-upload';// adding this causes the spec files to no longer detect the below custom command typings.declarenamespaceCypress{// In VS Code, "Cypress" gets greyed out as "unused".interfaceChainable{
...
}}
I think this happens because the addition of the "import" keyword turns the file into a module. I tried adding the export keywords like so:
// in support/commands.ts/// <reference types="cypress" />import'cypress-file-upload';// adding this causes the spec files to no longer detect the below custom command typings.exportdeclarenamespaceCypress{// In VS Code, "Cypress" gets greyed out as "unused".exportinterfaceChainable{
...
}}
but that didn't work immediately. I think such a setup would require importing "Cypress" from the commands file in every spec file.
I am using Typescript 4.3
Suggested Fix:
This solution worked for me: use /// <reference types="cypress-file-upload" /> like so:
Current behavior:
The recommended way of adding typings support (
import 'cypress-file-upload';
) clashes with the user's typings for their custom commands.I think this happens because the addition of the "import" keyword turns the file into a module. I tried adding the export keywords like so:
but that didn't work immediately. I think such a setup would require importing "Cypress" from the commands file in every spec file.
I am using Typescript 4.3
Suggested Fix:
This solution worked for me: use
/// <reference types="cypress-file-upload" />
like so:It doesn't require adding imports to all the spec files, which is nice.
The text was updated successfully, but these errors were encountered: