Skip to content

Commit

Permalink
fix fromEntries return type, closes #1745
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Aug 22, 2022
1 parent 57a7555 commit 5fededa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ high state of flux, you're at risk of it changing without notice.

- **Polish**
- add `chainTaskOptionKW`, #1744 (@AmirabbasJ)
- fix `fromEntries` return type, closes #1745 (@gcanti)
fix wrong type parameter order:
- `FromIO`
- `chainIOK`
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ReadonlyRecord.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ Converts a `ReadonlyArray` of `[key, value]` tuples into a `ReadonlyRecord`.
**Signature**

```ts
export declare const fromEntries: <A>(fa: readonly (readonly [string, A])[]) => Record<string, A>
export declare const fromEntries: <A>(fa: readonly (readonly [string, A])[]) => Readonly<Record<string, A>>
```

**Example**
Expand Down
2 changes: 1 addition & 1 deletion src/ReadonlyRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ export const toEntries = toReadonlyArray
*
* assert.deepStrictEqual(fromEntries([['a', 1], ['b', 2], ['a', 3]]), { b: 2, a: 3 })
*/
export const fromEntries = <A>(fa: ReadonlyArray<readonly [string, A]>): Record<string, A> => {
export const fromEntries = <A>(fa: ReadonlyArray<readonly [string, A]>): ReadonlyRecord<string, A> => {
const out: Record<string, A> = {}
for (const a of fa) {
out[a[0]] = a[1]
Expand Down

0 comments on commit 5fededa

Please sign in to comment.