Function buildInstance
- buildInstance<const Type extends string, Data extends object>(
data: [NoInfer<Type>] extends [symbol]
? { data?: Data; whfsType: Type<Type> }
: string extends NoInfer<Type>
? InstanceSource
: {
data?: [NoInfer<Type>] extends [keyof WHFSTypes]
? DisallowExtraPropsRecursive<
Data,
WHFSTypes[NoInfer<NoInfer<Type<(...)>>>]["SetFormat"],
>
: undefined | { [key: string]: CodecImportMemberType };
whfsType: keyof WHFSTypes;
},
options?: ImportOptions,
): Promise<
[NoInfer<Type>] extends [keyof WHFSTypes]
? TypedInstance<NoInfer<NoInfer<Type<Type>>>>
: Instance,
>Type Parameters
- const Type extends string
- Data extends object
Parameters
- data: [NoInfer<Type>] extends [symbol]
? { data?: Data; whfsType: Type<Type> }
: string extends NoInfer<Type>
? InstanceSource
: {
data?: [NoInfer<Type>] extends [keyof WHFSTypes]
? DisallowExtraPropsRecursive<
Data,
WHFSTypes[NoInfer<NoInfer<Type<(...)>>>]["SetFormat"],
>
: undefined | { [key: string]: CodecImportMemberType };
whfsType: keyof WHFSTypes;
} Optionaloptions: ImportOptions
Returns Promise<
[NoInfer<Type>] extends [keyof WHFSTypes]
? TypedInstance<NoInfer<NoInfer<Type<Type>>>>
: Instance,
>
Constructs an Instance from source data. If the whfsType is a constant, an instance of that type is returned. The source data won't be type-checked at compile-time if the whfsType has type 'string'.