I'm currently facing an issue with one of my projects where the TypeScript compiler is not flagging a type mismatch that I would normally expect it to catch. Interestingly, when I run the same code block in the TypeScript playground, it does throw an error as expected. I'm not sure if there might be something off in my project configuration - so far, I haven't encountered any similar issues throughout my project.
Below is the code snippet under scrutiny:
const func = (opt: { a: number; b: number; c: number }) => undefined;
const func2 = (arg: (opt: { a: number; b: number }) => undefined) => undefined;
func2(func);
This is the exact code causing trouble in the playground:
Check out the Playground Issue Here
This is how my tsconfig.json
looks like:
{
"compilerOptions": {
"sourceMap": true,
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"allowJs": false,
"moduleResolution": "node",
"lib": [ "es2015" ],
"experimentalDecorators": true,
"useDefineForClassFields": true,
"downlevelIteration": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"outDir": "./dist/",
"baseUrl": "./src",
"paths": {
"@lib/*": ["../../lib/src/*"], // relative to baseUrl
},
"lib": [ "dom" ],
"jsx": "react",
},
"types": [
"babylonjs"
],
"typeRoots": [
"./node_modules/@types"
],
"plugins": [
{
"name": "typescript-plugin-css-modules"
}
]
}
Currently, my project is using TypeScript version 4.3.5
.