Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strictNullChecks can cause failures #442

Closed
nevir opened this issue Jan 13, 2017 · 3 comments
Closed

strictNullChecks can cause failures #442

nevir opened this issue Jan 13, 2017 · 3 comments
Labels

Comments

@nevir
Copy link

nevir commented Jan 13, 2017

It appears like ts-loader causes the TS compiler to parse .d.ts files in a different mode than what the compiler normally does?

From a working ts-loader based project (occurs on both webpack 1 & 2), on typescript 2.1:

  1. Set "strictNullChecks": true"
  2. Import a module that has a function that is declared with an optional options argument that is also destructured. In my case, that's apollo-client's constructor.

Running ./node_modules/.bin/tsc directly compiles without complaint. Running ts-loader results in:

ERROR in /node_modules/apollo-client/lib/src/ApolloClient.d.ts
(28,18): error TS2459: Type '{ networkInterface?: NetworkInterface | undefined; reduxRootKey?: string | undefined; reduxRootSe...' has no property 'networkInterface' and no string index signature.
…

Here's the complete tsconfig.json being used, as well:

{
  "compilerOptions": {
    "charset": "utf-8",
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "jsx": "react",
    "module": "commonjs",
    "newLine": "LF",
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "outDir": "./dist/",
    "pretty": true,
    "strictNullChecks": true,
    "target": "es5",
    "lib": [
      "dom",
      "es2016",
      "es2017.object"
    ],
    "sourceMap": true
  },
  "exclude": [
    "dist",
    "build",
    "node_modules"
  ]
}

Possibly related to microsoft/TypeScript#8681

@johnnyreilly
Copy link
Member

Thanks for the detailed report; that's always appreciated. If you have ideas on how to remedy this we always welcome PRs.

@stale
Copy link

stale bot commented Jan 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 19, 2019
@stale
Copy link

stale bot commented Jan 26, 2019

Closing as stale. Please reopen if you'd like to work on this further.

@stale stale bot closed this as completed Jan 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants