typescript compilerOptions not reflected
See original GitHub issueCypress TypeScript compilator probably do not reflects some of compilerOptions
. In my case it looks like e.g. strict
is ignored.
I am sure that my tsconfig.json
is the one which is used because e.g. I have forgotten "noEmitHelpers": true
and it raised errors so I needed to remove it.
It was working with webpack compiler.
Current behavior:
tsconfig.json:
{
"compilerOptions": {
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"strictPropertyInitialization": true,
"preserveConstEnums": false,
"target": "es5",
"lib": ["es5", "dom", "es2015.core", "es2015.promise", "es2015.iterable", "es2015.collection"],
"types": ["cypress"],
"sourceMap": true,
"removeComments": false
},
"include": ["**/*.ts"]
}
test:
describe("example", () => {
it("example", () => {
let a: boolean | undefined;
let b: boolean = a;
console.log(b);
});
});
VS Code reflects tsconfig.json
and shows error:
Type 'boolean | undefined' is not assignable to type 'boolean'.
Type 'undefined' is not assignable to type 'boolean'.ts(2322)
Cypress run doesn’t reflects tsconfig.json
and successfully compiles script.
Desired behavior:
Cypress also reflects tsconfig.json
and shows error:
Type 'boolean | undefined' is not assignable to type 'boolean'.
Type 'undefined' is not assignable to type 'boolean'.ts(2322)
Versions
4.5.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:26 (3 by maintainers)
Top Results From Across the Web
Why are these tsconfig paths not working? - Stack Overflow
In case anyone is using VSCode and having trouble getting the /* solution to work. Try Cmd+Shift+P > Typescript: Restart TS Server. –...
Read more >TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript project... Compiler Options. Top Level....
Read more >Common TypeScript module problems and how to solve them
Solution 1: Locate the correct directory When we use this configuration, TypeScript compiler “jumps” up a directory from the src directory and ...
Read more >TypeScript errors and how to fix them
TypeScript does not allow statements in such ambient context declaration which ... the reflect-metadata package to shim the upcoming Metadata Reflection API ...
Read more >Understanding TypeScript Configuration Options
When allowJs is true , TypeScript will allow JavaScript files to be compiled but, it will not do type-checking. Here's some example file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I still don’t understand where is the problem in allowing it. I am developer so I should decide whether I prefer faster build or safer build. Web-pack pre-processor is just another unnecessary configuration I have to maintain…
In regards to the original issue, Cypress now supports most compiler options for spec files, but will continue to only transpile files by default and not type check them for performance reasons, so setting
"strict": true
will have no effect.We do not plan to add a global option to configure this, as it can be accomplished through the preprocessor API.