-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Missing Class "File" in react-native #38061
Comments
Which langauge are you referring to? JS/Java/Kotlin/ObjC/C++? |
I'm referring to Javascript. Appwrite is a backend platform like firebase: https:/appwrite.io |
|
Now that i'm a little bit familiar with the react-native code i see, that there is a File class in the library: But this Class does not show up in my IDEs like webstorm or VSCode. Is there something wrong with its export? |
Yup that's most likely because we are not exporting Blob from the |
Sorry, but i can't import the class File directly.
and get a undefined is not a function. |
I found out, that File is missing in the file "globals.d.ts". I'll make a pull request to add the declaration. |
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 . ## 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: #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
With limited exceptions, almost all of RN’s public JS APIs should be imported directly from “react-native”. Concrete “.js” files should generally not be imported. We will be limiting the ability to do this for files not meant to be public in the future via the “package.json” exports field. |
Closing bc the PR was merged. |
Yes, i thought that importing File cannot be the right way. |
Description
In react-native there is no class "File". It would make Uploads easier with appwrite because their storage.createFile method only supports File.
React Native Version
0.71.11
Output of
npx react-native info
System:
OS: macOS 13.4
CPU: (8) arm64 Apple M1 Pro
Memory: 67.23 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 19.1.0 - ~/.nvm/versions/node/v19.1.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v19.1.0/bin/yarn
npm: 9.3.1 - ~/.nvm/versions/node/v19.1.0/bin/npm
Watchman: 2023.05.22.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: Flamingo 2022.2.1 Patch 2 Flamingo 2022.2.1 Patch 2
Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.11 => 0.71.11
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Create new react-native project, edit app.tsx and try to use the common "new File()" command.
Snack, code example, screenshot, or link to a repository
no
The text was updated successfully, but these errors were encountered: