SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

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.

![image](https://github.com/facebook/react-native/assets/10697889/f2d75973-61ff-4874-ad8e-2c0898b82d27)

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
L
Louie Colgan committed
823b1f467b42b6d8b68a2f4af292c2663f192cd2
Parent: 0f48e86
Committed by Facebook GitHub Bot <[email protected]> on 7/26/2023, 10:21:52 AM