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

[lte-reader] The "??" operator here will always return the left operand #67

Closed
cj-christoph-gysin opened this issue Nov 23, 2023 · 0 comments · Fixed by #71
Closed

[lte-reader] The "??" operator here will always return the left operand #67

cj-christoph-gysin opened this issue Nov 23, 2023 · 0 comments · Fixed by #71

Comments

@cj-christoph-gysin
Copy link

https://github.com/alanshaw/it-tar/blob/4dc79e1066bf0620b8ac990480aed951337fc8f4/src/lte-reader.ts#L26C1-L26C52

I noticed this while running this through esbuild:

● [DEBUG] The "??" operator here will always return the left operand [suspicious-nullish-coalescing]

    node_modules/it-tar/dist/src/lte-reader.js:21:38:
      21 │                     if (done === true ?? nextValue == null) {
         ╵                                       ~~

  The left operand of the "??" operator here will never be null or undefined, so it will always be
  returned. This usually indicates a bug in your code:

    node_modules/it-tar/dist/src/lte-reader.js:21:24:
      21 │                     if (done === true ?? nextValue == null) {
         ╵                         ~~~~~~~~~~~~~

Maybe this should read:

                    if (done === true && nextValue == null) {

?

achingbrain added a commit that referenced this issue Feb 21, 2024
Restores the [pre-typescript](https://github.com/alanshaw/it-tar/blob/f6e492a44070816c4989af89e1602e656a27ecd4/lte-reader.js#L20)
behaviour of `lte-reader` to just checking that the `done` value
is true.

Adds tests to prevent regressions.

Closes #67
achingbrain added a commit that referenced this issue Feb 22, 2024
Restores the [pre-typescript](https://github.com/alanshaw/it-tar/blob/f6e492a44070816c4989af89e1602e656a27ecd4/lte-reader.js#L20)
behaviour of `lte-reader` to just checking that the `done` value
is true.

Adds tests to prevent regressions.

Closes #67
github-actions bot pushed a commit that referenced this issue Feb 22, 2024
## [6.0.5](v6.0.4...v6.0.5) (2024-02-22)

### Bug Fixes

* esbuild warning about ?? operator in lte-reader ([#71](#71)) ([e12843f](e12843f)), closes [/github.com/alanshaw/it-tar/blob/f6e492a44070816c4989af89e1602e656a27ecd4/lte-reader.js#L20](https://github.com/alanshaw//github.com/alanshaw/it-tar/blob/f6e492a44070816c4989af89e1602e656a27ecd4/lte-reader.js/issues/L20) [#67](#67)
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 a pull request may close this issue.

1 participant