Skip to content

Fix URL constructor type to accept URL as first argument#55402

Open
emily8rown wants to merge 1 commit intofacebook:mainfrom
emily8rown:export-D92271127
Open

Fix URL constructor type to accept URL as first argument#55402
emily8rown wants to merge 1 commit intofacebook:mainfrom
emily8rown:export-D92271127

Conversation

@emily8rown
Copy link
Contributor

Summary:
According to the URL API specification, the first parameter is a USVString, which accepts anything stringifiable. Since URL objects are stringifiable, they should be accepted.

This change mirrors what we already do for the base parameter, which accepts string | URL and the spec also expects USVString.

Changelog:

[GENERAL] [Changed] - Changed Flow type for URL constructor to accept URL as first argument, matching the second argument type

https://url.spec.whatwg.org/#dom-url-url

Differential Revision: D92271127

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 4, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 4, 2026

@emily8rown has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92271127.

)

Summary:

According to the URL API specification, the first parameter is a USVString, which accepts anything stringifiable. Since URL objects are stringifiable, they should be accepted.

This change mirrors what we already do for the `base` parameter, which accepts `string | URL` and the spec also expects USVString.

## Changelog:
[GENERAL] [Changed] - Changed Flow type for `URL` constructor to accept `URL` as first argument, matching the second argument type

https://url.spec.whatwg.org/#dom-url-url

Differential Revision: D92271127
emily8rown added a commit to emily8rown/react-native that referenced this pull request Feb 4, 2026
)

Summary:

According to the URL API specification, the first parameter is a USVString, which accepts anything stringifiable. Since URL objects are stringifiable, they should be accepted.

This change mirrors what we already do for the `base` parameter, which accepts `string | URL` and the spec also expects USVString.

## Changelog:
[GENERAL] [Changed] - Changed Flow type for `URL` constructor to accept `URL` as first argument, matching the second argument type

https://url.spec.whatwg.org/#dom-url-url

Differential Revision: D92271127
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. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants