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

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 https://github.com/facebook/react-native/issues/38061 .

## Changelog:
[GENERAL] [FIXED] Fixed missing File declaration in Typescript global.d.ts
<!-- 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

Pull Request resolved: https://github.com/facebook/react-native/pull/38165

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.

Reviewed By: rshest

Differential Revision: D47209461

Pulled By: cortinico

fbshipit-source-id: 0884dfe786ea3a5070aa0a487a8e74463c8f1a0f
This commit is contained in:
trashcoder
2023-07-04 09:47:53 -07:00
committed by Facebook GitHub Bot
parent f2d93a3d28
commit 9c0441b8a1
+14
View File
@@ -80,6 +80,20 @@ declare var Blob: {
new (blobParts?: Array<Blob | string>, options?: BlobOptions): Blob;
};
interface File extends Blob {
name: string;
lastModified: number;
}
declare var File: {
prototype: File;
new (
fileParts?: Array<Blob | string>,
name?: string,
options?: BlobOptions,
): File;
};
type FormDataValue =
| string
| {name?: string | undefined; type?: string | undefined; uri: string};