Skip to content

Nullish semantics missed MetaProperty #60439

Closed

Description

🔎 Search Terms

never nullish

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play/?target=1&ts=5.6.3#code/MYGwhgzhAEAa0G8BQ1XWAewHYQC4CcBXYXDfACgEpEU06BLAM2nKwFMB3AOlzHwHM2uaAH4R0AMwAmasjry0uABb4MHaABUAngAc2AUXyqKAAwDC2PERJloASSy4QXAMpt+AWzaO2+aPjYAR0J6AJgAcnYOcJNKWgUAX3joJKSgA

💻 Code

class X {
    constructor() {
        const p = new.target ?? 32;
    }
}

🙁 Actual behavior

Incorrectly says

right operand of ?? is unreachable because the left operand is never nullish

🙂 Expected behavior

No error

Additional information about the issue

No response

Activity

  1. added 2 commits that reference this issue on Nov 6, 2024
    d2f36cf
    316f0ab
  2. added
    Fix Available
    on Nov 6, 2024
  3. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugFix Available

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions