Skip to content

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

Closed

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)

Activity

  1. added
    Fixed
    on Oct 4, 2021
  2. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugFixed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions