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

fix(helpers): Add non-null asserts to min/max function usage #392

Merged
merged 1 commit into from Dec 25, 2023

Conversation

Uzaaft
Copy link
Contributor

@Uzaaft Uzaaft commented Nov 22, 2023

When typechecking my own code, I get the following errors, attached below.
From what I understand, the underlying library is using the spread operator on the input, which itself would error out on an empty array. This PR attempts to fix the type checker issues by simply guarantee-ing that the output is non-null.
Another potential fix is that we instead spread the input, i.e something like:

    let pivot = dayjs.min(...[start, end]);

image

@wa0x6e
Copy link
Owner

wa0x6e commented Dec 25, 2023

hey, thanks for the fix, can you cleanup the PR, and keep changes only in src/helpers/DateHelper.ts ?

@Uzaaft
Copy link
Contributor Author

Uzaaft commented Dec 25, 2023

hey, thanks for the fix, can you cleanup the PR, and keep changes only in src/helpers/DateHelper.ts ?

Sorry, an overview from my part. fixed it now

@wa0x6e wa0x6e merged commit 276baeb into wa0x6e:master Dec 25, 2023
@ghost ghost mentioned this pull request Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants