Skip to content

Conditional type evaluation of type aliases produces different result than their equivalent substitution #48070

@someBrown

Description

@someBrown

Bug Report

🔎 Search Terms

extends

🕗 Version & Regression Information

v4.5.4

⏯ Playground Link

Playground link with relevant code

💻 Code

type S<X> = <T>() => T extends X ? 1 : '2'
type Foo = S<'s1'> 
type Foo2 = S<'s2'>
type Result1 = Foo extends Foo2 ? true : false 

type Result2 = S<'s1'> extends S<'s2'> ? true : false

🙁 Actual behavior

For the result2 expression, the only difference from result1 is that result1 uses the type rather than the specific S<'s1'> ,But they returned a completely different result. Result1 return true,Result2 return false

🙂 Expected behavior

type Result1 and type Result2 should return false

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: Conditional TypesThe issue relates to conditional typesFix AvailableA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions