facebook/idx

Typescript types do not work on undefined as first parameter (new test case)

Closed this issue · 4 comments

@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

Can you please send a copy of your tsconfig.json?

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/**/*"]
}

I think I need to upgrade. I'm on 2.5.0. c0ae953

will report back

yeah, that was the issue. Thanks all.