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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type mismatch openPicker using singleSelectedMode #131

Open
mitsuharu opened this issue Nov 24, 2023 · 2 comments 路 May be fixed by #132
Open

Type mismatch openPicker using singleSelectedMode #131

mitsuharu opened this issue Nov 24, 2023 · 2 comments 路 May be fixed by #132

Comments

@mitsuharu
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch @baronha/react-native-multiple-image-picker@1.1.6 for the project I'm working on.

I notice that openPicker type is not correct in TypeScript.
I want to use singleSelectedMode, but TypeScript suggests MultiPicker.

Here is the diff that solved my problem:

diff --git a/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts b/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts
index 690360c..f8ec0d3 100644
--- a/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts
+++ b/node_modules/@baronha/react-native-multiple-image-picker/src/index.d.ts
@@ -93,16 +93,15 @@ interface MediaTypeResults {
   [MediaType.ALL]: ImageResults | VideoResults;
 }
 
-export type IOpenPicker = <T extends MediaType = MediaType.ALL>(
-  options: MultiPickerOptions & MediaTypeOptions[T] & Options<T>
-) => Promise<MediaTypeResults[T][]>;
-
 type MultipleImagePickerType = {
-  openPicker: IOpenPicker;
+  openPicker<T extends MediaType = MediaType.ALL>(
+    options: MultiPickerOptions & MediaTypeOptions[T] & Options<T>
+  ): Promise<MediaTypeResults[T][]>;
+  openPicker<T extends MediaType = MediaType.ALL>(
+    options: SinglePickerOptions & MediaTypeOptions[T] & Options<T>
+  ): Promise<MediaTypeResults[T]>;
 };
 
 const { MultipleImagePicker } = NativeModules;
 
-export const { openPicker } = MultipleImagePicker as MultipleImagePickerType;
-
 export default MultipleImagePicker as MultipleImagePickerType;

This issue body was partially generated by patch-package.

@baronha
Copy link
Owner

baronha commented Nov 26, 2023

It would be great if I could get PR from you

@mitsuharu
Copy link
Author

Thanks!
I make PR #132

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 a pull request may close this issue.

2 participants