expo: SDK 32 TypeScript errors
Just a heads up: I’m using typescript in my project and right after updating to SDK 32, a few errors were picked up by the compiler.
In my codebase:
takeSnapshotAsyncgivesProperty 'snapshotContentContainer' is required in type 'SnapshotOptions'
I don’t see snapshotContentContainer anywhere in the docs, what does it do ?
-
DocumentPicker.getDocumentAsyncgives'copyToCacheDirectory' does not exist in type 'GetDocumentOptions'and yet it is (still ?) in the docs -
ImagePicker.launchImageLibraryAsyncgives'base64' and 'exif' does not exist in type 'ImageLibraryOptions' -
startAsyncis marked as required inAppLoading.d.tsbut from the docs:
The following props are recommended, but optional for the sake of backwards compatibility
Can I still use AppLoading the same way ?
In expo’s codebase: These errors appear repeatedly in a bunch of files
Namespace 'React' has no exported member 'ComponentProps'Namespace 'React' has no exported member 'RefObject'Namespace 'React' has no exported member 'Context'Generic type 'Component<P, S>' requires between 0 and 2 type argumentsGeneric type 'ComponentClass<P>' requires between 0 and 1 type arguments
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 29 (20 by maintainers)
It’s merged 🎉
The latest version of
expopackage doesn’t have type declaration files and I have sent a PR to DT to update the types: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/32002In the long run we will include .d.ts definitions with the expo package. Until then, we have no types (other than in the source .ts files) from the Expo team.
can confirm @dai-shi config works for me with minor changes because src is my root dir:
Hi, I’m back! 😁
This is my project: https://github.com/dai-shi/typescript-expo-apollo-boilerplate and especially the config is here.
OK, understood. I’ll look for a config to use
@types/expoinstead ofexpo. Thanks for your prompt response.We publish the packages:
masterif we’re during the release process (no other changes land onmasterin that time)sdk-XXbranch is created, from which we publish the packagesIn such case, the proper place to look for published
expo-asset@32.0.0would be https://github.com/expo/expo/tree/sdk-32/packages/expo-asset. 🙂Hey all, thanks for the comments!
takeSnapshotAsyncdoc after upgrading the underlyingreact-native-view-shot, on it!copyToCacheDirectoryis missing in TS declaration, docs are correctbase64andexifstartAsyncshould be optionalWhen it comes to React problems, on what
@types/reactversion are you? 🤔 We compileexpoagainst@types/react@^16.7.7, maybe on this version it would work? 🙂