Skip to content

Nullish semantics missed MetaPropertyΒ #60439

@RyanCavanaugh

Description

@RyanCavanaugh

πŸ”Ž 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

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions