Repository navigation
Commit 9075c45
authored
Type jest test and hook callbacks as
Summary:
The jest callbacks were typed `(done) => ?Promise<unknown>`. With Flow's `experimental.ts_void`, a callback that returns `void`, such as `afterEach(() => cleanup())`, no longer fits that type. The callbacks are now typed as in TypeScript's `types/jest`:
- tests: `ProvidesCallback`, i.e. `((done) => void) | (() => PromiseLike<unknown>)`;
- hooks: `ProvidesHookCallback`, i.e. `(() => any) | ProvidesCallback`;
- `each` callbacks: `(...args) => any`.
The `done` parameter of the `afterEach` callback in `dev-middleware`'s `ServerUtils` test is now annotated. Flow 0.340 can't infer its type from the union.
Changelog: [Internal]
Differential Revision: D133411234
Pull Request resolved: #60192@types/jest does1 parent 5c062e6 commit 9075c45
2 files changed
Lines changed: 19 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1003 | 1003 | | |
1004 | 1004 | | |
1005 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
1006 | 1011 | | |
1007 | 1012 | | |
1008 | | - | |
| 1013 | + | |
1009 | 1014 | | |
1010 | 1015 | | |
1011 | 1016 | | |
1012 | 1017 | | |
1013 | | - | |
| 1018 | + | |
1014 | 1019 | | |
1015 | 1020 | | |
1016 | 1021 | | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
| 1022 | + | |
1021 | 1023 | | |
1022 | 1024 | | |
1023 | | - | |
| 1025 | + | |
1024 | 1026 | | |
1025 | 1027 | | |
1026 | 1028 | | |
| |||
1049 | 1051 | | |
1050 | 1052 | | |
1051 | 1053 | | |
1052 | | - | |
| 1054 | + | |
1053 | 1055 | | |
1054 | 1056 | | |
1055 | 1057 | | |
| |||
1064 | 1066 | | |
1065 | 1067 | | |
1066 | 1068 | | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
| 1069 | + | |
1072 | 1070 | | |
1073 | 1071 | | |
1074 | 1072 | | |
| |||
1077 | 1075 | | |
1078 | 1076 | | |
1079 | 1077 | | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
| 1078 | + | |
1085 | 1079 | | |
1086 | 1080 | | |
1087 | 1081 | | |
1088 | 1082 | | |
1089 | | - | |
| 1083 | + | |
1090 | 1084 | | |
1091 | 1085 | | |
1092 | 1086 | | |
| |||
1098 | 1092 | | |
1099 | 1093 | | |
1100 | 1094 | | |
1101 | | - | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
| 1095 | + | |
1106 | 1096 | | |
1107 | 1097 | | |
1108 | 1098 | | |
1109 | 1099 | | |
1110 | | - | |
| 1100 | + | |
1111 | 1101 | | |
1112 | 1102 | | |
1113 | 1103 | | |
| |||
1126 | 1116 | | |
1127 | 1117 | | |
1128 | 1118 | | |
1129 | | - | |
| 1119 | + | |
1130 | 1120 | | |
1131 | 1121 | | |
1132 | 1122 | | |
| |||
1140 | 1130 | | |
1141 | 1131 | | |
1142 | 1132 | | |
1143 | | - | |
| 1133 | + | |
1144 | 1134 | | |
1145 | 1135 | | |
1146 | 1136 | | |
1147 | 1137 | | |
1148 | 1138 | | |
1149 | 1139 | | |
1150 | 1140 | | |
1151 | | - | |
| 1141 | + | |
1152 | 1142 | | |
1153 | 1143 | | |
1154 | 1144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
0 commit comments