chore: Update dynamic

This commit is contained in:
BluJ
2023-05-01 15:20:40 -06:00
parent a30ed1f0ab
commit ec51315c23
6 changed files with 607 additions and 18 deletions

View File

@@ -103,4 +103,23 @@ export class Variants<Type, WD, ConfigType> {
return variants
}, validator)
}
/** Danger, don't filter everything!! */
disableVariants(
fn: LazyBuild<
WD,
ConfigType,
Array<Type extends { unionSelectKey: infer B } ? B : never>
>,
) {
const previousMe = this
return new Variants<Type, WD, ConfigType>(async (options) => {
const answer = { ...(await previousMe.build(options)) }
const filterValues = await fn(options)
for (const key of filterValues) {
delete answer[key as any]
}
return answer
}, this.validator)
}
}