Skip to content

Merge and align global.d.ts and globals.d.ts files #49516

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

Closed
wants to merge 2 commits into from

Conversation

coado
Copy link
Contributor

@coado coado commented Feb 19, 2025

Summary:
Merge global.d.ts and globals.d.ts into one file and align some definitions with implementations.

Changelog:
[General][Changed] - Improve TypeScript types for global objects

Reviewed By: huntie

Differential Revision: D69772463

@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. p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Feb 19, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69772463

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69772463

coado added a commit to coado/react-native that referenced this pull request Feb 21, 2025
Summary:
Pull Request resolved: facebook#49516

Merge global.d.ts and globals.d.ts into one file and align some definitions with implementations.

Changelog:
[General][Changed] - Improve TypeScript types for `global` objects

Reviewed By: huntie

Differential Revision: D69772463
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69772463

coado added a commit to coado/react-native that referenced this pull request Feb 21, 2025
Summary:
Pull Request resolved: facebook#49516

Merge global.d.ts and globals.d.ts into one file and align some definitions with implementations.

Changelog:
[General][Changed] - Improve TypeScript types for `global` objects

Reviewed By: huntie

Differential Revision: D69772463
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69772463

coado added a commit to coado/react-native that referenced this pull request Feb 21, 2025
Summary:
Pull Request resolved: facebook#49516

Merge global.d.ts and globals.d.ts into one file and align some definitions with implementations.

Changelog:
[General][Changed] - Improve TypeScript types for `global` objects

Reviewed By: huntie

Differential Revision: D69772463
Summary: dtslint throws an error when <reference path> is used to reference another package. The suggested approach is to use <reference types> instead. It requires that the [email protected] is used.

Differential Revision: D69749044
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69772463

coado added a commit to coado/react-native that referenced this pull request Feb 24, 2025
Summary:
Pull Request resolved: facebook#49516

Merge global.d.ts and globals.d.ts into one file and align some definitions with implementations.

Changelog:
[General][Changed] - Improve TypeScript types for `global` objects

Reviewed By: huntie

Differential Revision: D69772463
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69772463

coado added a commit to coado/react-native that referenced this pull request Feb 24, 2025
Summary:
Pull Request resolved: facebook#49516

Merge global.d.ts and globals.d.ts into one file and align some definitions with implementations.

Changelog:
[General][Changed] - Improve TypeScript types for `global` objects

Reviewed By: huntie

Differential Revision: D69772463
Summary:
Pull Request resolved: facebook#49516

Merge global.d.ts and globals.d.ts into one file and align some definitions with implementations.

Changelog:
[General][Changed] - Improve TypeScript types for `global` objects

Reviewed By: huntie

Differential Revision: D69772463
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69772463

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 25, 2025
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 094c5be.

facebook-github-bot pushed a commit that referenced this pull request May 20, 2025
Summary:
After #49516 TSC would not find the global types.

Types reference expect a package name but was given a path to a declaration.

TS doc: https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-path-

This PR changes `types` to `path` to fix the issue.

`dtslint` fails with `no-bad-reference` rule, but the `../src` lives in the same package in `react-native` package.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [FIXED] - Reference `global.d.ts` using `path` so they can be resolved by TSC

Pull Request resolved: #51104

Test Plan:
Before the change with current RN 0.79.2 TSC would fail on resolving the global types (example from [Sentry RN SDK build](getsentry/sentry-react-native@134d810)):

![Screenshot 2025-05-05 at 17 18 04](https://github.com/user-attachments/assets/b264c8da-aa21-49d8-9597-82586291a01a)

After the change to path TSC finds the global types.

Using TSC Version 4.9.5

Reviewed By: huntie

Differential Revision: D74208815

Pulled By: coado

fbshipit-source-id: 2fd51d79061ffb356c047604213cff7a425f167e
react-native-bot pushed a commit that referenced this pull request May 23, 2025
Summary:
After #49516 TSC would not find the global types.

Types reference expect a package name but was given a path to a declaration.

TS doc: https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-path-

This PR changes `types` to `path` to fix the issue.

`dtslint` fails with `no-bad-reference` rule, but the `../src` lives in the same package in `react-native` package.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [FIXED] - Reference `global.d.ts` using `path` so they can be resolved by TSC

Pull Request resolved: #51104

Test Plan:
Before the change with current RN 0.79.2 TSC would fail on resolving the global types (example from [Sentry RN SDK build](getsentry/sentry-react-native@134d810)):

![Screenshot 2025-05-05 at 17 18 04](https://github.com/user-attachments/assets/b264c8da-aa21-49d8-9597-82586291a01a)

After the change to path TSC finds the global types.

Using TSC Version 4.9.5

Reviewed By: huntie

Differential Revision: D74208815

Pulled By: coado

fbshipit-source-id: 2fd51d79061ffb356c047604213cff7a425f167e
cipolleschi pushed a commit that referenced this pull request Jun 4, 2025
Summary:
After #49516 TSC would not find the global types.

Types reference expect a package name but was given a path to a declaration.

TS doc: https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-path-

This PR changes `types` to `path` to fix the issue.

`dtslint` fails with `no-bad-reference` rule, but the `../src` lives in the same package in `react-native` package.

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [FIXED] - Reference `global.d.ts` using `path` so they can be resolved by TSC

Pull Request resolved: #51104

Test Plan:
Before the change with current RN 0.79.2 TSC would fail on resolving the global types (example from [Sentry RN SDK build](getsentry/sentry-react-native@134d810)):

![Screenshot 2025-05-05 at 17 18 04](https://github.com/user-attachments/assets/b264c8da-aa21-49d8-9597-82586291a01a)

After the change to path TSC finds the global types.

Using TSC Version 4.9.5

Reviewed By: huntie

Differential Revision: D74208815

Pulled By: coado

fbshipit-source-id: 2fd51d79061ffb356c047604213cff7a425f167e
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 Merged This PR has been merged. p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants