Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update type definition of last #100

Merged
merged 1 commit into from
May 13, 2024
Merged

Conversation

deiga
Copy link
Contributor

@deiga deiga commented May 10, 2024

last would return undefined if input is an array of length 0, but this is not reflected in the type definition

`last` would return `undefined` if input is an array of length 0, but this is not reflected in the type definition
@selfrefactor selfrefactor merged commit 59f39f2 into selfrefactor:master May 13, 2024
@selfrefactor
Copy link
Owner

Txs for spotting this. I did merge it to master, but I need to add more changes before making a release. I will update once release is made.

@selfrefactor
Copy link
Owner

I added the comment about 0 length, but the change that will be in next version is a bit different. Still, the end result is the same:

it('empty array', () => {
    const list = [] as const
    head(emptyList) // $ExpectType undefined
    head(list) // $ExpectType undefined
    last(emptyList) // $ExpectType undefined
    last(list) // $ExpectType undefined
  })

I will inform when it is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants