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:
takeSnapshotAsync
givesProperty 'snapshotContentContainer' is required in type 'SnapshotOptions'
I don’t see snapshotContentContainer
anywhere in the docs, what does it do ?
-
DocumentPicker.getDocumentAsync
gives'copyToCacheDirectory' does not exist in type 'GetDocumentOptions'
and yet it is (still ?) in the docs -
ImagePicker.launchImageLibraryAsync
gives'base64' and 'exif' does not exist in type 'ImageLibraryOptions'
-
startAsync
is marked as required inAppLoading.d.ts
but 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 arguments
Generic 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
expo
package 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/expo
instead ofexpo
. Thanks for your prompt response.We publish the packages:
master
if we’re during the release process (no other changes land onmaster
in that time)sdk-XX
branch is created, from which we publish the packagesIn such case, the proper place to look for published
expo-asset@32.0.0
would be https://github.com/expo/expo/tree/sdk-32/packages/expo-asset. 🙂Hey all, thanks for the comments!
takeSnapshotAsync
doc after upgrading the underlyingreact-native-view-shot
, on it!copyToCacheDirectory
is missing in TS declaration, docs are correctbase64
andexif
startAsync
should be optionalWhen it comes to React problems, on what
@types/react
version are you? 🤔 We compileexpo
against@types/react@^16.7.7
, maybe on this version it would work? 🙂