Skip to content

TS2869 not fired on stubTrue() ?? falseΒ #62119

@fregante

Description

@fregante

πŸ”Ž Search Terms

TS 2869
Right operand of ?? is unreachable because the left operand is never nullish

πŸ•— Version & Regression Information

TS2869 was introduced in v5.6 and all version until 5.9-nightly are affected.

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.9.0-dev.20250724#code/C4JwrgpgBA-DUDMCGAbAzhA3AWAFAAp8BKKAXgD4pRIS5FUMcDizLqIiW7l0I8g

πŸ’» Code

true ?? false;             // detected
(() => true) ?? false;     // detected
(() => true)() ?? false    // not detected

πŸ™ Actual behavior

(() => true)() ?? false does not report any errors

πŸ™‚ Expected behavior

(() => true)() ?? false
~~~~~~~~~~~~~~
             ^ Right operand of ?? is unreachable because the left operand is never nullish

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions