Skip to content

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

Closed
@DetachHead

Description

@DetachHead

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions