Skip to content

Commit 4664292

Browse files
jbrown215facebook-github-bot
authored andcommitted
Defaults for jest.fn's type parameters
Summary: This diff adds defaults to Jest.fn's type params. An upcoming change to flow will be more restrictive about how we implicitly instantiation type arguments. Since the argument to jest.fn is often omitted, this signature is the single biggest offender of our new rules. To reduce the error diff, I'm adding reasonable defaults so that the mocked function can still behave like a function without adding extra flow errors where there were none before. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D40394215 fbshipit-source-id: 2df596b6ba8b54680694e08c432a1e7c94dc2df0
1 parent 3e58a9c commit 4664292

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flow/jest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ type JestObjectType = {
810810
* Returns a new, unused mock function. Optionally takes a mock
811811
* implementation.
812812
*/
813-
fn<TArguments: $ReadOnlyArray<mixed>, TReturn>(
813+
fn<TArguments: $ReadOnlyArray<mixed> = $ReadOnlyArray<mixed>, TReturn = any>(
814814
implementation?: (...args: TArguments) => TReturn,
815815
): JestMockFn<TArguments, TReturn>,
816816
/**

0 commit comments

Comments
 (0)