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: remove disguised type assertion #402

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

igorwessel
Copy link
Contributor

What

All the matchers that were using generic, weren't taking advantage of the full potential of typescript.

Why

The vast majority of matchers related to Array, Object and Satisfy.
Doesn't take advantage of typescript's potential to be able to infer types, and because of that, the object matchers that were related to the object's key allowed passing other keys

without refactor:
example_without_refactor

with refactor:
example_with_refactor

I did this refactoring on all Object, Array and Satisfy matchers.
It was just those who used generics.

Notes

Housekeeping

  • Unit tests
  • Documentation is up to date
  • No additional lint warnings
  • Typescript definitions are added/updated where relevant

JSDoc provides the opportunity of expressing type definitions in Javascript comments via @tags or @annotations.
However, most of those have a comparable and/or inherent way of being expressed by Typescript's syntax,
therefore becoming redundant.
All the matchers that were using generic,
weren't taking advantage of the full potential of typescript.
@igorwessel
Copy link
Contributor Author

I realized it's not a good idea to do this due to the .not operators.

@igorwessel igorwessel marked this pull request as draft January 25, 2022 11:58
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

1 participant