chore: Add in the documentation for the withWrapperData

This commit is contained in:
BluJ
2023-05-02 16:31:55 -06:00
parent bda5fc59a2
commit 13b0933f96
4 changed files with 59 additions and 0 deletions

View File

@@ -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>
}