Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add signal to Request type #38536

Closed
wants to merge 1 commit into from
Closed

Conversation

ljbc1994
Copy link
Contributor

@ljbc1994 ljbc1994 commented Jul 20, 2023

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

For example, running the following:

Without providing a signal

console.log(new Request('https://www.facebook.com'));

will result in the following:

{"_bodyInit": undefined, "_bodyText": "", "bodyUsed": false, "credentials": "same-origin", "headers": {"map": {}}, "method": "GET", "mode": null, "referrer": null, "signal": undefined, "url": "https://www.facebook.com"}

Changelog:

[GENERAL] [FIXED] - Add 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'

Test Plan:

Adding to global.d.ts in a file will resolve the problem, demonstrating that this works.

interface Request {
    readonly signal: AbortSignal | undefined
}

@facebook-github-bot
Copy link
Contributor

Hi @ljbc1994!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@github-actions github-actions bot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 20, 2023
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,842,747 +1
android hermes armeabi-v7a 8,152,151 +4
android hermes x86 9,348,437 +2
android hermes x86_64 9,191,271 +2
android jsc arm64-v8a 9,454,434 +3
android jsc armeabi-v7a 8,635,757 +3
android jsc x86 9,537,429 +3
android jsc x86_64 9,780,790 +1

Base commit: f6c417c
Branch: main

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jul 20, 2023
@facebook-github-bot
Copy link
Contributor

@jacdebug has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ljbc1994, thank you so much for taking care of this.

I left a comment on the PR as I think we should improve it.

@github-actions
Copy link

This pull request was successfully merged by @ljbc1994 in 823b1f4.

When will my fix make it into a release? | Upcoming Releases

@github-actions github-actions bot added the Merged This PR has been merged. label Jul 26, 2023
billnbell pushed a commit to billnbell/react-native that referenced this pull request Jul 29, 2023
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: facebook#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
billnbell pushed a commit to billnbell/react-native that referenced this pull request Jul 29, 2023
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: facebook#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
billnbell pushed a commit to billnbell/react-native that referenced this pull request Jul 29, 2023
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: facebook#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants