mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-04-01 21:13:11 +00:00
feat: Make config of the config top
This commit is contained in:
@@ -65,20 +65,18 @@ export class Variants<Type, WD> {
|
||||
static of<
|
||||
TypeMap extends Record<string, Record<string, any>>,
|
||||
WrapperData,
|
||||
ConfigType,
|
||||
TypeOut = {
|
||||
[K in keyof TypeMap & string]: {
|
||||
unionSelectKey: K
|
||||
unionValueKey: TypeMap[K]
|
||||
}
|
||||
}[keyof TypeMap & string],
|
||||
>(a: {
|
||||
[K in keyof TypeMap]: {
|
||||
name: string
|
||||
spec: Config<TypeMap[K], WrapperData>
|
||||
}
|
||||
}) {
|
||||
type TypeOut = {
|
||||
[K in keyof TypeMap & string]: {
|
||||
unionSelectKey: K
|
||||
unionValueKey: TypeMap[K]
|
||||
}
|
||||
}[keyof TypeMap & string]
|
||||
|
||||
const validator = anyOf(
|
||||
...Object.entries(a).map(([name, { spec }]) =>
|
||||
object({
|
||||
@@ -111,7 +109,7 @@ export class Variants<Type, WD> {
|
||||
required: false,
|
||||
})
|
||||
|
||||
return topConfig<WrapperData>()({
|
||||
return Config.of<WrapperData>()({
|
||||
myValue: a.withWrapperData(),
|
||||
})
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user