Why there's no options argument in Chainable.env()?
#34261
-
|
As the doc says, cypress/cli/types/cypress.d.ts Lines 2236 to 2253 in 6ff266f Actual error: Is there something I am missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
So the I reproduced it on 15.18.1: declare namespace Cypress {
interface Chainable {
env(keys: string[], options: Partial<Cypress.Loggable & Cypress.Timeoutable>): Chainable<Record<string, any>>
}
}Probably worth filing as a types bug so the .d.ts overloads match the command. |
Beta Was this translation helpful? Give feedback.
-
|
@sueun-dev |
Beta Was this translation helpful? Give feedback.
So the
cy.env()command implementation does take options:packages/driver/src/cy/commands/env.tshasenv (envVars, userOptions: EnvOptions = {})and readsoptions.log/options.timeout, and the docs listcy.env(keys, options). The problem iscli/types/cypress.d.tsonly shipsenv(keys: string[])overloads, so tsc gives youExpected 1 arguments, but got 2even though the call is fine at runtime.I reproduced it on 15.18.1:
cy.env(["v"], { log: false })fails typecheck. A small local augment clears it while the runtime still honors{ log: false }: