Internal
Extract the branch of a discriminated union whose discriminator property has exactly the literal type K. Works without knowing the discriminator property name by scanning all properties of each branch.
K
Example:
// Union = { type: 'assigned'; ... } | { type: 'commented'; ... }ExtractBranch<Union, 'assigned'> // → { type: 'assigned'; ... } Copy
// Union = { type: 'assigned'; ... } | { type: 'commented'; ... }ExtractBranch<Union, 'assigned'> // → { type: 'assigned'; ... }
Extract the branch of a discriminated union whose discriminator property has exactly the literal type
K. Works without knowing the discriminator property name by scanning all properties of each branch.Example: