Skip to content

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

Open

Description

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

BugA bug in TypeScriptFix 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