Skip to content

Nullish semantics missed MetaProperty #60439

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

Closed
RyanCavanaugh opened this issue Nov 6, 2024 · 0 comments Β· Fixed by #60440
Closed

Nullish semantics missed MetaProperty #60439

RyanCavanaugh opened this issue Nov 6, 2024 · 0 comments Β· Fixed by #60440
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@RyanCavanaugh
Copy link
Member

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

@RyanCavanaugh RyanCavanaugh self-assigned this Nov 6, 2024
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Nov 6, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.8.0 milestone Nov 6, 2024
RyanCavanaugh added a commit to RyanCavanaugh/TypeScript that referenced this issue Nov 6, 2024
RyanCavanaugh added a commit to RyanCavanaugh/TypeScript that referenced this issue Nov 6, 2024
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants