Skip to content

Commit 31f7e84

Browse files
robhoganmeta-codesync[bot]
authored andcommitted
Make AbortSignal abort and timeout correctly static, add AbortSignal.any (#55371)
Summary: Pull Request resolved: #55371 `AbortSignal` `abort` and `timeout` are incorrectly typed as instance methods - they should be static methods. Also add the static `any()`, which returns a signal composed of other signals. MDN: - [`AbortSignal.any(signals: Iterable<AbortSignal>)`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static) - [`AbortSignal.abort(reason?: any)`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_static) - [`AbortSignal.timeout(time: number)`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static) Changelog: [Internal] Reviewed By: panagosg7 Differential Revision: D91904485 fbshipit-source-id: 0850c731cfaf1bf967582c85427acbd6bebcb5aa
1 parent aa84ed5 commit 31f7e84

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/react-native/flow/bom.js.flow

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,13 @@ declare class AbortController {
609609
}
610610

611611
declare class AbortSignal extends EventTarget {
612-
abort(reason?: $FlowFixMe): AbortSignal;
612+
static abort(reason?: $FlowFixMe): AbortSignal;
613+
static any(signals: Iterable<AbortSignal>): AbortSignal;
613614
+aborted: boolean;
614615
onabort: (event: Event) => unknown;
615616
+reason: $FlowFixMe;
616617
throwIfAborted(): void;
617-
timeout(time: number): AbortSignal;
618+
static timeout(time: number): AbortSignal;
618619
}
619620

620621
declare function fetch(

0 commit comments

Comments
 (0)