mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
fix: add signal to Request type (#38536)
Summary: The `Request` interface provided by `types/react-native` doesn't have a `signal` property when it should as this is something that is accessible on the `Request` object.  For example, running the following: #### Without providing a `signal` ```ts console.log(new Request('https://www.facebook.com')); ``` will result in the following: ```ts {"_bodyInit": undefined, "_bodyText": "", "bodyUsed": false, "credentials": "same-origin", "headers": {"map": {}}, "method": "GET", "mode": null, "referrer": null, "signal": {}, "url": "https://www.facebook.com"} ``` ## Changelog: [GENERAL] [FIXED] - Fixed missing property `signal` for the `Request` interface ## Reproduce 1. Add `new Request('https://www.facebook.com').signal` to a typescript file 2. TS will error `Property 'signal' does not exist on type 'Request'` Pull Request resolved: https://github.com/facebook/react-native/pull/38536 Test Plan: Adding to `global.d.ts` in a file will resolve the problem, demonstrating that this works. ```ts interface Request { readonly signal: AbortSignal | undefined } ``` Reviewed By: NickGerleman Differential Revision: D47660506 Pulled By: jacdebug fbshipit-source-id: ef1459fbaca5d8f31bf8539bd61ac5e447111fec
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0f48e86fed
commit
823b1f467b
@@ -187,6 +187,7 @@ declare interface Request extends Object, Body {
|
||||
readonly mode: RequestMode_;
|
||||
readonly referrer: string;
|
||||
readonly url: string;
|
||||
readonly signal: AbortSignal | undefined;
|
||||
clone(): Request;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user