feat: Update with the new side effects, types, and orginization.

This commit is contained in:
BluJ
2023-03-06 12:42:40 -07:00
parent 19504ef559
commit f74be4ec7d
10 changed files with 191 additions and 155 deletions

View File

@@ -39,17 +39,15 @@ import { Config } from ".";
```
*/
export class Variants<
A extends { [key: string]: ConfigSpec }
A extends { [key: string]: ConfigSpec },
> extends IBuilder<A> {
static of<
A extends {
[key: string]: Config<ConfigSpec>;
}
},
>(a: A) {
// deno-lint-ignore no-explicit-any
const variants: { [K in keyof A]: BuilderExtract<A[K]> } = {} as any;
for (const key in a) {
// deno-lint-ignore no-explicit-any
variants[key] = a[key].build() as any;
}
return new Variants(variants);
@@ -60,14 +58,14 @@ export class Variants<
}
static withVariant<K extends string, B extends ConfigSpec>(
key: K,
value: Config<B>
value: Config<B>,
) {
return Variants.empty().withVariant(key, value);
}
withVariant<K extends string, B extends ConfigSpec>(
key: K,
value: Config<B>
value: Config<B>,
) {
return new Variants({
...this.a,