mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Make AbortSignal abort and timeout correctly static, add AbortSignal.any (#55371)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
1 parent
aa84ed5c29
commit
31f7e84600
1 file changed
+3
-2
@@ -609,12 +609,13 @@ declare class AbortController {
|
||||
}
|
||||
|
||||
declare class AbortSignal extends EventTarget {
|
||||
abort(reason?: $FlowFixMe): AbortSignal;
|
||||
static abort(reason?: $FlowFixMe): AbortSignal;
|
||||
static any(signals: Iterable<AbortSignal>): AbortSignal;
|
||||
+aborted: boolean;
|
||||
onabort: (event: Event) => unknown;
|
||||
+reason: $FlowFixMe;
|
||||
throwIfAborted(): void;
|
||||
timeout(time: number): AbortSignal;
|
||||
static timeout(time: number): AbortSignal;
|
||||
}
|
||||
|
||||
declare function fetch(
|
||||
|
||||
Reference in new issue
Block a user