-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
I use cypress with the cucumber plugin and noticed that the following TypeScript code which compiles without a problem but crashes at runtime.
const a = 1;
a.should("be.visible");
This is because the following which is downloaded when I npm i cypress
: node_modules/cypress/types/chai/index.d.ts:1943
interface Object {
should: Chai.Assertion;
}
This is causing TypeScript to give me false positives everywhere because I called should()
on something that is not a Cypress Chainable but I don't find out about it until runtime.
Augmenting Object's TypeScript definition with an extra method seems like something we did away with since prototype JS taught us how bad it was. Why is it being done? Should I file a bug? It really stinks to have to run a file to be told I have what should be compilation errors.
Originally posted by @juanmendes in #16526