Typescript types do not work on undefined as first parameter (new test case)
Closed this issue · 4 comments
macalinao commented
@Horaddrim This doesn't solve the problem for me.
const myVar: { a: { b: string } } | null = null as {
a: { b: string };
} | null;
const something = idx(myVar, _ => _.a.b) || "TEST";
still fails the build.
Originally posted by @macalinao in https://github.com/facebookincubator/idx/issue_comments#issuecomment-449763073
Horaddrim commented
Can you please send a copy of your tsconfig.json
?
macalinao commented
For sure.
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"noEmit": true,
"suppressImplicitAnyIndexErrors": true,
"lib": ["dom", "es2017"],
"baseUrl": ".",
"paths": {
"~/*": ["./*"]
},
"plugins": [
{
"name": "typescript-styled-plugin",
"tags": ["styled", "injectGlobal"]
}
]
},
"include": [
"./components/**/*",
"./lib/**/*",
"./pages/**/*",
"./typings/svg.d.ts"
],
"exclude": ["./node_modules/**/*"]
}
macalinao commented
yeah, that was the issue. Thanks all.