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

Update globals.d.ts for File declaration in Typescript #38165

Closed
wants to merge 1 commit into from
Closed

Update globals.d.ts for File declaration in Typescript #38165

wants to merge 1 commit into from

Conversation

trashcoder
Copy link
Contributor

@trashcoder trashcoder commented Jul 3, 2023

Summary:

In Webstorm or VSCode when using Typescript the declaration of the class "File" is missing. So both IDEs show "File" as error. With this change it fixes the issue #38061 .

Fixes #38061

Changelog:

[GENERAL] [FIXED] Fixed missing File declaration in Typescript global.d.ts

Test Plan:

I ran
yarn run test-typescript
with no error

After that i initialized a new react-native project and installed the react-native library with my local changes of global.d.ts. Webstorm and VSCode now find the declaration of "File" and don't show "File" as error and suggest the right parameters.

@facebook-github-bot facebook-github-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 Jul 3, 2023
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 9,047,664 -2
android hermes armeabi-v7a 8,297,081 -1
android hermes x86 9,563,959 +2
android hermes x86_64 9,406,115 -1
android jsc arm64-v8a 9,606,382 +0
android jsc armeabi-v7a 8,733,108 +0
android jsc x86 9,693,421 +1
android jsc x86_64 9,939,708 +0

Base commit: bf7b81f
Branch: main

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 4, 2023
@facebook-github-bot
Copy link
Contributor

@cortinico merged this pull request in 9c0441b.

@NickGerleman
Copy link
Contributor

Does React native define a global File interface? Having this be a global seems a bit suspect.

@trashcoder
Copy link
Contributor Author

RN defines a exporting class File like the class Blob, which is global. And you could always instantiate that class File. The only thing I changed is that the IDE can use the typescript compliant declaration.

@trashcoder trashcoder deleted the File_Typescript_declaration branch July 6, 2023 06:46
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Class "File" in react-native
5 participants