Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.

Conversation

@krutoo
Copy link
Contributor

@krutoo krutoo commented Aug 27, 2021

According to documentation in readme.md

@kamilogorek
Copy link
Contributor

kamilogorek commented Aug 27, 2021

3rd argument is optional, so it should have ? modifier, see the default implementation here:

errorHandler = (_, invokeErr) => {
invokeErr();

@krutoo
Copy link
Contributor Author

krutoo commented Aug 27, 2021

3rd argument is optional, so it should have ? modifier, see the default implementation here:

errorHandler = (_, invokeErr) => {
invokeErr();

@kamilogorek is the third argument optional to use or really may be not passed?

@kamilogorek kamilogorek enabled auto-merge (squash) September 1, 2021 09:55
@kamilogorek
Copy link
Contributor

Ah, you are right. It's optional to use, not optional to be available. Thanks! :)

@kamilogorek kamilogorek merged commit ed4be5a into getsentry:master Sep 1, 2021
lobsterkatie added a commit that referenced this pull request Oct 7, 2021
Two years ago, in #155, we modified the `errorHandler` option to take a third argument, of the type `Compilation`. Though the _contents_ of the type exists in similar forms in webpack 4 and 5, in webpack 4[1] it's exported as `compilation.Compilation`, where as in webpack 5[2], it's exported at the top-level. 

This didn't matter much until about a month ago, when #308 updated the overall options type to reflect the addition of the third argument for `errorHandler`. That change was released in v 1.17.2. Because that PR used `Compilation` in its webpack 5/top-level form, anyone using this plugin together with webpack 4 and TS will receive the a compilation error when they import the plugin (assuming they have `skipLibCheck` set to `false` in their TS config).

This fixes that by using `unknown` as the type instead, and updates the docstring with a note about the above. It also changes the dev dependencies for `webpack` and `@types/webpack`. Even though the new version requirements will always result in 5.x getting installed, keeping the 4.41.31 entry is a reminder to anyone reading the file that a) we should preserve compatibility with 4.x, and b) that that's the minimum 4.x version we need to worry about (see #296 (comment)).

Fixes #321.

[1] https://github.com/DefinitelyTyped/DefinitelyTyped/blob/2ab8f4dea373a70d377549a97c0c36807f5a8151/types/webpack/v4/index.d.ts#L1288

[2] https://github.com/webpack/webpack/blob/da74127bfeacff017c5d60842351b4136afba794/types.d.ts#L1297
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants