Skip to content

Commit

Permalink
fix Config.Wrap incorrectly wrapping functions & arrays (#2762)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored May 16, 2024
1 parent e63057c commit 810f222
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-countries-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

fix Config.Wrap incorrectly wrapping functions & arrays
14 changes: 8 additions & 6 deletions packages/effect/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ export declare namespace Config {
* @since 2.0.0
* @category models
*/
export type Wrap<A> =
| (A extends Record<string, any> ? {
[K in keyof A]: Wrap<A[K]>
}
: never)
| Config<A>
export type Wrap<A> = [A] extends [Function] ? Config<A> :
[A] extends [ReadonlyArray<infer _>] ? Config<A> :
[A] extends [Record<string, any>] ?
| {
[K in keyof A]: Wrap<A[K]>
}
| Config<A>
: Config<A>
}

/**
Expand Down

0 comments on commit 810f222

Please sign in to comment.