johnnyreilly / fork-ts-checker-notifier-webpack-plugin

MIT License
53 stars 14 forks source link

TypeError: diagnostic.isErrorSeverity is not a function #33

Closed madaz closed 10 months ago

madaz commented 4 years ago

Expected Behaviour

Upgraded fork-ts-checker-webpack-plugin 3.1.1 => 4.0.2

To notify when typescript compile errors

Actual Behaviour

Added some typescript breaking code to test upgrade

const b: boolean = 'true';
(node:36892) UnhandledPromiseRejectionWarning: TypeError: diagnostic.isErrorSeverity is not a function
    at [redacted]\node_modules\fork-ts-checker-notifier-webpack-plugin\index.js:26:75
    at Array.find (<anonymous>)
    at ForkTsCheckerNotifierWebpackPlugin.buildNotification ([redacted]\node_modules\fork-ts-checker-notifier-webpack-plugin\index.js:26:45)
    at ForkTsCheckerNotifierWebpackPlugin.compilationDone ([redacted]\node_modules\fork-ts-checker-notifier-webpack-plugin\index.js:9:37)
    at SyncHook.eval [as call] (eval at create ([redacted]\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
    at ForkTsCheckerWebpackPlugin.handleServiceMessage ([redacted]\node_modules\fork-ts-checker-webpack-plugin\lib\index.js:395:36)
    at [redacted]\node_modules\fork-ts-checker-webpack-plugin\lib\index.js:254:35
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
(node:36892) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

Steps to Reproduce the Problem

node 12.14.1
windows 10 1909

webpack@4.41.5 webpack-cli@3.3.10 webpack-dev-server@3.10.1 typescript@3.7.5 fork-ts-checker-webpack-plugin@4.0.2 fork-ts-checker-notifier-webpack-plugin@1.0.3 eslint@6.8.0 @typescript-eslint/parser@2.16.0 @typescript-eslint/eslint-plugin@2.16.0

  // webpack.config.js

  plugins: [
     new ForkTsCheckerWebpackPlugin({
       async: true,
       eslint: true,
       useTypescriptIncrementalApi: true,
      }),
      new ForkTsCheckerNotifierWebpackPlugin({
        excludeWarnings: true,
        skipSuccessful: true,
      }),
  ]
npx webpack-dev-server

Location of a Minimal Repository that Demonstrates the Issue.

madaz commented 4 years ago

Ive rolled back to fork-ts-checker-webpack-plugin@3.1.1 and it seems the diagnostics/lints passed into compilationDone are NormalizedMessage where as in fork-ts-checker-webpack-plugin@4.0.2 they are plain objects

johnnyreilly commented 4 years ago

Yeah - they have changed. Some work (not much) needs to be done to switch the API. Fancy helping out? I bet it's pretty straightforward and I'm kinda snowed myself

madaz commented 4 years ago

I can take a look but wouldn't be able till next week.

On Thu, 23 Jan 2020, 16:16 John Reilly, notifications@github.com wrote:

Yeah - they have changed. Some work (not much) needs to be done to switch the API. Fancy helping out? I bet it's pretty straightforward and I'm kinda snowed myself

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johnnyreilly/fork-ts-checker-notifier-webpack-plugin/issues/33?email_source=notifications&email_token=AAIWJPOTY7QLZLUHHDIK3ADQ7EY35A5CNFSM4KKOGSMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJWEWRA#issuecomment-577522500, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIWJPOI7LD44UZSLZDGHRTQ7EY35ANCNFSM4KKOGSMA .

johnnyreilly commented 4 years ago

Go for it! 🤗