Skip to content

Commit

Permalink
fix: declare that of returns arrays of length 1
Browse files Browse the repository at this point in the history
  • Loading branch information
levino committed Aug 10, 2023
1 parent 01b8661 commit 3a934ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions dtslint/ts3.5/Array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ declare const ns: Array<number>
declare const ss: Array<string>
declare const tns: Array<[number, string]>

pipe(_.of('b'), ([value]: [string]) => value)

// prepend

pipe(ss, _.prepend('a')) // $ExpectType NonEmptyArray<string>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ const _chainRecBreadthFirst: ChainRec1<URI>['chainRec'] = RA._chainRecBreadthFir
* @category constructors
* @since 2.0.0
*/
export const of: <A>(a: A) => Array<A> = NEA.of
export const of: <A>(a: A) => [A] = NEA.of

/**
* Makes an empty `Array`, useful for building a [`Monoid`](#Monoid)
Expand Down

0 comments on commit 3a934ad

Please sign in to comment.