diff --git a/lib/config/builder/config.ts b/lib/config/builder/config.ts index 51bb612..d709e84 100644 --- a/lib/config/builder/config.ts +++ b/lib/config/builder/config.ts @@ -114,6 +114,20 @@ export class Config, 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()({ + myValue: a.withWrapperData(), + }) + ``` + */ withWrapperData() { return this as any as Config } diff --git a/lib/config/builder/list.ts b/lib/config/builder/list.ts index e0c3cfa..3b20e61 100644 --- a/lib/config/builder/list.ts +++ b/lib/config/builder/list.ts @@ -250,4 +250,22 @@ export class List { } }, 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()({ + myValue: a.withWrapperData(), + }) + ``` + */ + withWrapperData() { + return this as any as List + } } diff --git a/lib/config/builder/value.ts b/lib/config/builder/value.ts index 4ebb4f9..06ca397 100644 --- a/lib/config/builder/value.ts +++ b/lib/config/builder/value.ts @@ -672,6 +672,20 @@ export class Value { ) } + /** + * 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()({ + myValue: a.withWrapperData(), + }) + ``` + */ withWrapperData() { return this as any as Value } diff --git a/lib/config/builder/variants.ts b/lib/config/builder/variants.ts index f0641aa..5b625eb 100644 --- a/lib/config/builder/variants.ts +++ b/lib/config/builder/variants.ts @@ -103,7 +103,20 @@ export class Variants { 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()({ + myValue: a.withWrapperData(), + }) + ``` + */ withWrapperData() { return this as any as Variants }