Closed
Description
Bug Report
When attempting to put together som 786A e conditional types to extract information about branded types, TS 4.2 is no longer able to correctly infer your intent.
type Branded<T, A> = A & { __brand: T }
type BrandedValue<A> = A extends Branded<unknown, infer R> ? R : never
// Expected to be 'string' but is 'string & { __brand: T }' in 4.2+
type T1 = BrandedValue< Branded< 'GUID', string > >
🔎 Search Terms
- Branded Types
- Conditional Types
- TypeScript 4.2
🕗 Version & Regression Information
- This changed between versions 4.1.5 and 4.2 beta
⏯ Playground Link
Working example in 4.1.5
🙁 Actual behavior
The brand is not removed from the return type
🙂 Expected behavior
The brand should be removed from the return type