Skip to content

Commit 5db1a71

Browse files
mvitousekmeta-codesync[bot]
authored andcommitted
[flow] Support renderAsyncHook in hook compatibility mode
Summary: https://fb.workplace.com/groups/flow/posts/29900607966227767/?comment_id=29900879252867305&reply_comment_id=29929841776637719 Reviewed By: gkz Differential Revision: D86428639 fbshipit-source-id: ec4aa37ba0d8f4fc58c1c15b23bc4efb761b9c40
1 parent f8a14f6 commit 5db1a71

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/typing/react_rules.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ let compatibility_call call =
185185
true
186186
| {
187187
Ast.Expression.Call.callee =
188-
(_, Ast.Expression.(Identifier (_, { Ast.Identifier.name = "renderHook"; _ })));
188+
( _,
189+
Ast.Expression.(
190+
Identifier (_, { Ast.Identifier.name = "renderHook" | "renderAsyncHook"; _ }))
191+
);
189192
_;
190193
} ->
191194
true

tests/hook_syntax_compatibility/test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,6 @@ const [useXB, {w: useXC}] = ((42: any): [() => void, { w: () => void }])
7575
}
7676
declare const renderHook: any;
7777
renderHook(() => useH()); // no error
78+
declare const renderAsyncHook: any;
79+
renderAsyncHook(() => useH()); // no error
7880
}

0 commit comments

Comments
 (0)