Skip to content

Report errors in JS(X) files when CheckJS is enabled#564

Merged
johnnyreilly merged 1 commit intoTypeStrong:masterfrom
schmuli:fix-checkjs-errors
Jun 25, 2017
Merged

Report errors in JS(X) files when CheckJS is enabled#564
johnnyreilly merged 1 commit intoTypeStrong:masterfrom
schmuli:fix-checkjs-errors

Conversation

@schmuli
Copy link
Copy Markdown
Contributor

@schmuli schmuli commented Jun 25, 2017

Closes #518

@schmuli
Copy link
Copy Markdown
Contributor Author

schmuli commented Jun 25, 2017

@johnnyreilly This is the PR, as discussed. I wasn't able to run the tests locally, because of Corporate proxy settings, and some tests are failing. Additionally, I didn't add any tests for this change.

@johnnyreilly
Copy link
Copy Markdown
Member

Thanks! I think the test failure is just a flaky test (they're full integration tests and so we get the odd false negative) Just kicked off a test run again.

@johnnyreilly johnnyreilly merged commit bcbb3ce into TypeStrong:master Jun 25, 2017
@johnnyreilly
Copy link
Copy Markdown
Member

Great! Thanks for this - the fix will go out with the next release 👍

@schmuli schmuli deleted the fix-checkjs-errors branch June 26, 2017 08:17
@OliverJAsh
Copy link
Copy Markdown

I'm noticing that this is reporting errors from JS files inside node_modules. Is that expected? I.e. I get a lot more errors running via ts-loader than I do when running via tsc.

@johnnyreilly
Copy link
Copy Markdown
Member

Are you running with 2.2.2? Should be resolved now

@OliverJAsh
Copy link
Copy Markdown

I'm using version 2.4.1. Example of errors:

ERROR in ./~/react-dom/lib/ReactDOM.js
(43,3): error TS2304: Cannot find name '__REACT_DEVTOOLS_GLOBAL_HOOK__'.

ERROR in ./~/react-dom/lib/ReactDOM.js
(68,16): error TS2304: Cannot find name '__REACT_DEVTOOLS_GLOBAL_HOOK__'.

ERROR in ./~/react-dom/lib/ReactDOM.js
(82,40): error TS2551: Property 'documentMode' does not exist on type 'Document'. Did you mean 'DOCUMENT_NODE'?

@OliverJAsh
Copy link
Copy Markdown

Ah sorry, yes, ts-loader 2.2.2, tsc 2.4.1

@johnnyreilly
Copy link
Copy Markdown
Member

Also are you excluding node_modules in your webpack.config.js?

@OliverJAsh
Copy link
Copy Markdown

OliverJAsh commented Jul 3, 2017

@johnnyreilly Yes, I believe so:

{
  module: {
    rules: [
      {
        test: /\.ts$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
          },
          {
            loader: 'ts-loader',
            options: {
              entryFileIsJs: true,
            }
          },
        ],
      },
    ]
  }
}

@johnnyreilly
Copy link
Copy Markdown
Member

Hmmmm may be an issue then. If you lose the entryFileIsJs option does the problem resolve? (You will need to change the entry file too)

@schmuli
Copy link
Copy Markdown
Contributor Author

schmuli commented Jul 3, 2017

You can try the --skipLibCheck option but I haven't checked that this changes anything.

On the other hand, I am using 2.2.2 with a big mixed project, including lots of JS in node_modules and I haven't seen this issue yet, so this is probably a configuration issue. What does your tsconfig.json look like?

@OliverJAsh
Copy link
Copy Markdown

Have you enabled checkJs on that project?

@OliverJAsh
Copy link
Copy Markdown

@schmuli @johnnyreilly I spent awhile narrowing this issue down, smallest reproduction case here #577

@johnnyreilly
Copy link
Copy Markdown
Member

Thanks for the repro - we appreciate it! I wonder, could you test with ts-loader v2.2.0 please? This was the version prior to @schmuli's change. Does the issue arise with that version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants