feat(@jest/expect): Expose type of actual to Matchers by benjaminjkraft · Pull Request #13848 · jestjs/jest (original) (raw)

@benjaminjkraft

Matchers isn't as typed as some users would like (see jestjs#13334, jestjs#13812). For users who want to customize it by extending the Matchers interface, it's useful to have access to the type of actual (the argument of expect) so you can do, say,

interface Matchers<R, T> {
    toTypedEqual(expected: T): R
}

This commit exposes it. The first-party matchers still have the same types as before.

mrazauskas

@benjaminjkraft

@benjaminjkraft

mrazauskas

@benjaminjkraft @mrazauskas

Co-authored-by: Tom Mrazauskas tom@mrazauskas.de

mrazauskas

@benjaminjkraft @mrazauskas

Co-authored-by: Tom Mrazauskas tom@mrazauskas.de

mrazauskas

@benjaminjkraft

mrazauskas

@benjaminjkraft @mrazauskas

Co-authored-by: Tom Mrazauskas tom@mrazauskas.de

@benjaminjkraft @mrazauskas

Co-authored-by: Tom Mrazauskas tom@mrazauskas.de

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators

Mar 10, 2023

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})