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

fix: use union type in DocumentPicker #7064

Merged
merged 1 commit into from
Feb 17, 2020
Merged

fix: use union type in DocumentPicker #7064

merged 1 commit into from
Feb 17, 2020

Conversation

SimenB
Copy link
Contributor

@SimenB SimenB commented Feb 17, 2020

Why

This means that if type === 'success' then typeof uri === 'string' instead of string or undefined. This matches the docs as well: https://docs.expo.io/versions/latest/sdk/document-picker/#documentpickergetdocumentasyncoptions

On success returns a promise that resolves to an object containing { type: 'success', uri, name, size } where uri is a URI to the local document file, name is its original name and size is its size in bytes. If the user cancelled the document picking, the promise resolves to { type: 'cancel' }.

I suppose the undocumented fields in the return type is for web?

How

See "why". I made this change in the GitHub web UI.

Test Plan

I changed it locally and it works like I expected

Copy link
Member

@tsapeta tsapeta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Yeah, this previous type seems to be incorrect - thanks @SimenB for contributing! 🙇

@tsapeta tsapeta merged commit 9dab710 into expo:master Feb 17, 2020
@SimenB SimenB deleted the patch-1 branch February 17, 2020 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants