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 Includes null includes undefined #413

Merged
merged 1 commit into from Jul 2, 2022

Conversation

JonghwanWon
Copy link
Sponsor Contributor

I modified what passes when null includes undefined.

@JonghwanWon JonghwanWon closed this Jul 1, 2022
@JonghwanWon JonghwanWon deleted the includes branch July 1, 2022 14:09
@JonghwanWon JonghwanWon restored the includes branch July 1, 2022 14:14
@JonghwanWon JonghwanWon reopened this Jul 1, 2022
@sindresorhus
Copy link
Owner

sindresorhus commented Jul 1, 2022

Can you explain your change? Why does changing the order fix the issue?

@JonghwanWon
Copy link
Sponsor Contributor Author

JonghwanWon commented Jul 2, 2022

Can you explain your change? Why does changing the order fix the issue?

Hello, @sindresorhus thank your comment. First at all, My English is not good. so, I attached source code. Please forgive me if there are any mistakes.

I've distinguished the old 'Includes' from the changed 'Includes' for comparison.

type T1= IsEqual<null, null>  // true
type T2= IsEqual<undefined, undefined>  // true
type T3= IsEqual<null, undefined>  // false

type T4 = OldIncludes<[null], null>  // true
type T5 = NewIncludes<[null], null>  // true

type T6 = OldIncludes<[undefined], undefined>  // true
type T7 = NewIncludes<[undefined], undefined>  // true

type T8 = OldIncludes<[null], undefined>  // Expected to be "false". but type is "true"
type T9 = NewIncludes<[null], undefined>  // false

I thought it was strange that the result was different when I ended up using isEqual depending on the internal behavior in Includes.

@sindresorhus sindresorhus merged commit de5e7fc into sindresorhus:main Jul 2, 2022
skarab42 pushed a commit to skarab42/type-fest that referenced this pull request Jul 3, 2022
@JonghwanWon JonghwanWon deleted the includes branch July 4, 2022 01:27
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