As I delve into e2e testing in Cypress using TypeScript, I am puzzled by the TS errors that are cropping up locally while everything runs smoothly on CI.
The peculiar thing is that these TS errors only started appearing after checking out a particular PR, even though no changes were made to the tsconfig settings. This has left me scratching my head wondering what could be causing this sudden issue.
Upon inspecting the current tsconfig file used in Cypress, I can see that it includes the resolveJsonModule
option:
{
"compilerOptions": {
"strict": true,
"target": "es6",
"lib": ["esnext", "dom"],
"baseUrl": "./",
"resolveJsonModule": true,
"esModuleInterop": true,
"noImplicitAny": false,
"types": ["cypress", "@testing-library/cypress"]
},
"include": ["**/*.ts"]
}
Interestingly, after cloning the aforementioned PR, a cascade of TS errors surfaced, none of which were present prior to implementing the PR: https://i.sstatic.net/MJf93.png
UPDATE: A breakthrough - it appears that the issue might be specific to Visual Studio Code (VSCODE) as the application builds flawlessly from the command line.