You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repeated identical conditional return type triggers TS2719 ("Two different types with this name exist") under tsgo #3488
index.ts(5,5): error TS2719: Type '<K extends T>() => null extends T ? K | null : undefined extends T ? K | undefined : K' is not assignable to type '<K extends T>() => null extends T ? K | null : undefined extends T ? K | undefined : K'. Two different types with this name exist, but they are unrelated.
Type 'null extends T ? K | (T & undefined) | (T & null) : undefined extends T ? K | (T & undefined) | (T & null) : K | (T & undefined) | (T & null)' is not assignable to type 'null extends T ? K | (T & null) : undefined extends T ? K | (T & undefined) : K'.
Type 'K | (undefined extends T ? K | (T & undefined) | (T & null) : K | (T & undefined) | (T & null)) | (T & undefined) | (T & null)' is not assignable to type 'null extends T ? K | (T & null) : undefined extends T ? K | (T & undefined) : K'.
Type 'undefined extends T ? K | (T & undefined) | (T & null) : K | (T & undefined) | (T & null)' is not assignable to type 'null extends T ? K | (T & null) : undefined extends T ? K | (T & undefined) : K'.
Type 'K | (T & undefined) | (T & null)' is not assignable to type 'null extends T ? K | (T & null) : undefined extends T ? K | (T & undefined) : K'.
Type 'T & undefined' is not assignable to type 'null extends T ? K | (T & null) : undefined extends T ? K | (T & undefined) : K'.
Type 'K | (T & undefined) | (T & null)' is not assignable to type 'K | (T & null)'.
Type 'T & undefined' is not assignable to type 'K | (T & null)'.
Type 'T & undefined' is not assignable to type 'T & null'.
Type 'T & undefined' is not assignable to type 'null'.
The two types in the diagnostic are written out identically. Note also that in tsgo's elaboration the type has been re-distributed (K | (T & undefined) | (T & null)) compared with what the user wrote (K | null or K | undefined), suggesting the conditional is being reduced differently in the two positions before identity is checked.
Activity