-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
🔎 Search Terms
"same type assignable"
"Two different types with this name exist, but they are unrelated."
🕗 Version & Regression Information
Please keep and fill in the line that best applies:
- This is a crash
- This is the behavior in every version I tried (3.3.3 to nightly), and I reviewed the FAQ for entries about it
⏯ Playground Link
Playground link with relevant code
💻 Code
declare let a: <T>() => (T extends true ? true : false) & boolean
declare let b: <T>() => (T extends true ? true : false) & boolean
a = b🙁 Actual behavior
This produces the following error message:
Type '<T>() => (T extends true ? true : false) & boolean' is not assignable to
type '<T>() => (T extends true ? true : false) & boolean'.
Two different types with this name exist, but they are unrelated.
Type 'false' is not assignable to type '(T extends true ? true : false) & boolean'.
Also, the following unexpectedly removes the error message:
- Removing
& boolean - Replacing
T extends true ? true : falsebytrue - Replacing
T extends true ? true : falsebyT extends true ? true : true - Replacing
b's type bytypeof a
🙂 Expected behavior
Since the two types are identical, a and b should be assignable to each other.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue