| 552 | } |
| 553 | |
| 554 | const struct = <NER extends Record<string, Config.Config<any>>>(r: NER): Config.Config< |
| 555 | { |
| 556 | [K in keyof NER]: [NER[K]] extends [{ [ConfigTypeId]: { _A: (_: never) => infer A } }] ? A : never |
| 557 | } |
| 558 | > => { |
| 559 | const entries = Object.entries(r) |
| 560 | let result = pipe(entries[0][1], map((value) => ({ [entries[0][0]]: value }))) |
| 561 | if (entries.length === 1) { |
| 562 | return result as any |
| 563 | } |
| 564 | const rest = entries.slice(1) |
| 565 | for (const [key, config] of rest) { |
| 566 | result = pipe( |
| 567 | result, |
| 568 | zipWith(config, (record, value) => ({ ...record, [key]: value })) |
| 569 | ) |
| 570 | } |
| 571 | return result as any |
| 572 | } |
| 573 | |
| 574 | /** @internal */ |
| 575 | export const succeed = <A>(value: A): Config.Config<A> => { |