Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 843 Bytes

paratype.discriminatortype.md

File metadata and controls

25 lines (15 loc) · 843 Bytes

Home > paratype > discriminatorType

discriminatorType() function

Constructs a Type that represents a union of other types, each with a common distriminator property.

Signature:

export declare function discriminatorType<Key extends string & keyof TypeOf<Union[keyof Union]>, Union extends Record<string, Type>>(key: Key, union: Union): Type<TypeOf<Union[keyof Union]>>;

Parameters

Parameter Type Description
key Key
union Union

Returns:

Type<TypeOf<Union[keyof Union]>>