Skip to content

getVariantKeyValue

getVariantKeyValue<T>(variant): CandidKeyValue<T>

Defined in: utils/candid.ts:51

Extract variant key and value from a variant type Works with types like: type User = { ‘Business’: BusinessUser } | { ‘Individual’: IndividualUser }

T extends Record<string, any>

The variant type

T

CandidKeyValue<T>

A tuple containing the key and value of the variant

Error if the variant object does not have exactly one key