feat: Move to filtered values

This commit is contained in:
BluJ
2023-05-01 16:44:08 -06:00
parent 04c8e23e21
commit f953160866
4 changed files with 24 additions and 25 deletions

View File

@@ -585,8 +585,13 @@ export class Value<Type, WD, ConfigType> {
default?: string | null
},
aVariants: Variants<Type, WrapperData, ConfigType>,
getDisabledFn: LazyBuild<
WrapperData,
ConfigType,
Array<Type extends { unionSelectKey: infer B } ? B & string : never>
>,
) {
return new Value<AsRequired<Type, Required>, WrapperData, ConfigType>(
return new Value<Type | null | undefined, WrapperData, ConfigType>(
async (options) => ({
type: "union" as const,
description: null,
@@ -594,8 +599,9 @@ export class Value<Type, WD, ConfigType> {
...a,
variants: await aVariants.build(options as any),
...requiredLikeToAbove(a.required),
disabled: (await getDisabledFn(options)) || [],
}),
asRequiredParser(aVariants.validator, a),
aVariants.validator.optional(),
)
}