I'm attempting to customize my Cypress configuration by including a new property using the following method:
Cypress.Commands.overwrite('getUser', (originalFn: any) => {
const overwriteOptions = {
accountPath: `accounts/${options.accountPath}`,
};
return originalFn(overwriteOptions).then(response =>
Cypress.config({
authUserString: generateAuthUserString(response.email, response.password),
})
);
});
However, I am encountering the following error:
No overload matches this call.
Overload 1 of 4, '(key: "url" | "browser" | "autoOpen" | "browserUrl" | "clientRoute" | "cypressEnv" | "isNewProject" | "isTextTerminal" | "morgan" | "parentTestsFolder" | "parentTestsFolderDisplay" | ... 84 more ... | "cypressBinaryRoot"): string | ... 16 more ... | { ...; }', gave the following error.
Argument of type '{ authUserString: any; }' is not assignable to parameter of type '"url" | "browser" | "autoOpen" | "browserUrl" | "clientRoute" | "cypressEnv" | "isNewProject" | "isTextTerminal" | "morgan" | "parentTestsFolder" | "parentTestsFolderDisplay" | ... 84 more ... | "cypressBinaryRoot"'.
Overload 2 of 4, '(Object: TestConfigOverrides): void', gave the following error.
Argument of type '{ authUserString: any; }' is not assignable to parameter of type 'TestConfigOverrides'.
Object literal may only specify known properties, and 'authUserString' does not exist in type 'TestConfigOverrides'.ts(2769)
Is there a way to successfully add custom properties to the Cypress config while working with Typescript?