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 types for toSatisfy()/toSatisfyAll() #163

Merged
merged 2 commits into from
Sep 8, 2018

Conversation

tony19
Copy link
Contributor

@tony19 tony19 commented Sep 7, 2018

What

Bug fix in types

Why

The type for the arg of toSatisfy()/toSatisfyAll() is currently a predicate () => boolean, but the predicate itself has an argument (the item being iterated). The current signature causes an error in this TypeScript code:

expect(fooItem).toSatisfy((x: any) => x.myBoolProp); // Argument of type '(x: any) => any' is not assignable to parameter of type '() => boolean'.
expect(fooArray).toSatisfyAll((x: any) => x.myBoolProp); // Argument of type '(x: any) => any' is not assignable to parameter of type '() => boolean'.

Housekeeping

  • Unit tests
  • Documentation is up to date
  • No additional lint warnings
  • Add yourself to contributors list (yarn contributor)
  • Typescript definitions are added/updated where relevant

@codecov-io
Copy link

Codecov Report

Merging #163 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #163   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         103    103           
  Lines         500    500           
  Branches       85     85           
=====================================
  Hits          500    500

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bb532b...9f8ecb2. Read the comment docs.

@benjaminkay93
Copy link
Contributor

offt <3 nice once :P

@mattphillips
Copy link
Member

@tony19 nice catch thanks 👍

@mattphillips mattphillips merged commit af54007 into jest-community:master Sep 8, 2018
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

4 participants