chore: charlie 14

This commit is contained in:
BluJ
2023-04-11 15:50:01 -06:00
parent d8d36be5e2
commit f3c1cea0b9
5 changed files with 64 additions and 29 deletions

View File

@@ -14,8 +14,14 @@ import { TypeFromProps } from "../util/propertiesMatcher";
export function setupConfigExports<A extends InputSpec, ConfigType>(options: {
spec: Config<A>;
dependsOn: DependsOn;
write(options: { effects: Effects; input: TypeFromProps<A> }): Promise<ConfigType>;
read(options: { effects: Effects; config: ConfigType }): Promise<null | DeepPartial<TypeFromProps<A>>>;
write(options: {
effects: Effects;
input: TypeFromProps<A>;
}): Promise<ConfigType>;
read(options: {
effects: Effects;
config: ConfigType;
}): Promise<null | DeepPartial<TypeFromProps<A>>>;
}) {
const validator = options.spec.validator();
return {
@@ -30,7 +36,9 @@ export function setupConfigExports<A extends InputSpec, ConfigType>(options: {
getConfig: (async ({ effects, config }) => {
return {
spec: options.spec.build(),
config: nullIfEmpty(await options.read({ effects, config: config as ConfigType })),
config: nullIfEmpty(
await options.read({ effects, config: config as ConfigType })
),
};
}) as ExpectedExports.getConfig,
};