mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Allow async extension functions
According to http://jestjs.io/docs/en/expect.html#expectextendmatchers > expect.extends also supports async matchers. Async matchers return a Promise so you will need to await the returned value. Let's use an example matcher to illustrate the usage of them. We are going to implement a very similar matcher than toBeDivisibleBy, only difference is that the divisible number is going to be pulled from an external source. This updates the typings of `ExpectExtendMap` to allow a `Promise` to be returned.
This commit is contained in:
Vendored
+1
-1
@@ -269,7 +269,7 @@ declare namespace jest {
|
||||
}
|
||||
|
||||
interface ExpectExtendMap {
|
||||
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean };
|
||||
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean } | Promise<{ message(): string, pass: boolean }>;
|
||||
}
|
||||
|
||||
interface SnapshotSerializerOptions {
|
||||
|
||||
Reference in New Issue
Block a user