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

This condition will always return 'false' (2367) error no longer appears on template literal types with keyword types #45201

Closed
DetachHead opened this issue Jul 27, 2021 · 1 comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Milestone

Comments

@DetachHead
Copy link
Contributor

Bug Report

πŸ”Ž Search Terms

This condition will always return 'false'

πŸ•— Version & Regression Information

  • This changed between versions 4.2.3 and 4.3.5

⏯ Playground Link

πŸ’» Code

declare const foo: `foo${number}`
foo === 'bar' // no error even though types are incompatible

const bar: `foo${number}` = 'bar' //error: Type '"bar"' is not assignable to type '`foo${number}`'

πŸ™ Actual behavior

no error when comparing the incompatible types

πŸ™‚ Expected behavior

the same error that occurs when you do the same thing in typescript <=4.2.3

This condition will always return 'false' since the types '`foo${number}`' and '"bar"' have no overlap.(2367)
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jul 27, 2021
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jul 27, 2021
@DetachHead
Copy link
Contributor Author

DetachHead commented Oct 2, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants