mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
chore: Add in the documentation for the withWrapperData
This commit is contained in:
@@ -114,6 +114,20 @@ export class Config<Type extends Record<string, any>, WD> {
|
||||
},
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Use this during the times that the input needs a more specific type.
|
||||
* Used in types that the value/ variant/ list/ config is constructed somewhere else.
|
||||
```ts
|
||||
const a = Config.text({
|
||||
name: "a",
|
||||
required: false,
|
||||
})
|
||||
|
||||
return topConfig<WrapperData>()({
|
||||
myValue: a.withWrapperData(),
|
||||
})
|
||||
```
|
||||
*/
|
||||
withWrapperData<NewWrapperData extends WD>() {
|
||||
return this as any as Config<Type, NewWrapperData>
|
||||
}
|
||||
|
||||
@@ -250,4 +250,22 @@ export class List<Type, WD> {
|
||||
}
|
||||
}, arrayOf(aSpec.spec.validator))
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this during the times that the input needs a more specific type.
|
||||
* Used in types that the value/ variant/ list/ config is constructed somewhere else.
|
||||
```ts
|
||||
const a = Config.text({
|
||||
name: "a",
|
||||
required: false,
|
||||
})
|
||||
|
||||
return topConfig<WrapperData>()({
|
||||
myValue: a.withWrapperData(),
|
||||
})
|
||||
```
|
||||
*/
|
||||
withWrapperData<NewWrapperData extends WD>() {
|
||||
return this as any as List<Type, NewWrapperData>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -672,6 +672,20 @@ export class Value<Type, WD> {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this during the times that the input needs a more specific type.
|
||||
* Used in types that the value/ variant/ list/ config is constructed somewhere else.
|
||||
```ts
|
||||
const a = Config.text({
|
||||
name: "a",
|
||||
required: false,
|
||||
})
|
||||
|
||||
return topConfig<WrapperData>()({
|
||||
myValue: a.withWrapperData(),
|
||||
})
|
||||
```
|
||||
*/
|
||||
withWrapperData<NewWrapperData extends WD>() {
|
||||
return this as any as Value<Type, NewWrapperData>
|
||||
}
|
||||
|
||||
@@ -103,7 +103,20 @@ export class Variants<Type, WD> {
|
||||
return variants
|
||||
}, validator)
|
||||
}
|
||||
/**
|
||||
* Use this during the times that the input needs a more specific type.
|
||||
* Used in types that the value/ variant/ list/ config is constructed somewhere else.
|
||||
```ts
|
||||
const a = Config.text({
|
||||
name: "a",
|
||||
required: false,
|
||||
})
|
||||
|
||||
return topConfig<WrapperData>()({
|
||||
myValue: a.withWrapperData(),
|
||||
})
|
||||
```
|
||||
*/
|
||||
withWrapperData<NewWrapperData extends WD>() {
|
||||
return this as any as Variants<Type, NewWrapperData>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user