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

Simplifies typings on just-compare #480

Merged
merged 2 commits into from
Aug 7, 2022

Conversation

neil-morrison44
Copy link
Contributor

Fixes #476

  • Typings now just take 2 values of unknown type & returns a boolean, which matches the JS

@angus-c
Copy link
Owner

angus-c commented Aug 6, 2022

Thank you!

@angus-c
Copy link
Owner

angus-c commented Aug 6, 2022

@neil-morrison44 FYI The TS tests now fail because it (correctly) no longer expects an error. So just need to remove the @ts-expect-error comments here

@angus-c angus-c merged commit ee4d7cd into angus-c:master Aug 7, 2022
@angus-c
Copy link
Owner

angus-c commented Aug 7, 2022

Published as [email protected] (I intended to make this a minor bump but I messed up 😄 )

@sven-nyffenegger
Copy link

@neil-morrison44 @angus-c I'm wondering what the motivation was to remove the typings? This change removes the ability to make use of generics (which was fixed with #460)

@neil-morrison44
Copy link
Contributor Author

@sven-nyffenegger the linked issue explains it fairly well I think - it's mostly to be a better representation of the underlying JS rather than presuming the two things being compared are the same type.

If you were writing a pure TS function with the same functionality as the JS (i.e. you can compare across types) I think you'd be required to use unknown.

Supplying extra opinions / constraints on top of that (like that the two inputs should be of the same type) shouldn't be the place of the .d.TS typings.

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.

Overly strict TS typings on just-compare
3 participants