Skip to content

Commit

Permalink
fix typings for openCropper function
Browse files Browse the repository at this point in the history
  • Loading branch information
ivpusic committed Sep 6, 2020
1 parent 43f1214 commit 2d834b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ declare module "react-native-image-crop-picker" {

type ImageOptions = CommonOptions & {
mediaType: 'photo';

/**
* Selected image location. This is null when the `writeTempFile` option is set to `false`.
*/
path: string;


/**
* Width of result image when used with `cropping` option.
*/
Expand Down Expand Up @@ -315,6 +310,13 @@ declare module "react-native-image-crop-picker" {
compressImageQuality?: number;
}

type CropperOptions = ImageOptions & {
/**
* Selected image location
*/
path: string;
}

type VideoOptions = CommonOptions & {
mediaType: 'video';

Expand Down Expand Up @@ -460,14 +462,14 @@ declare module "react-native-image-crop-picker" {

export function openPicker<O extends Options>(options: O): Promise<PossibleArray<O, MediaType<O>>>;
export function openCamera<O extends Options>(options: O): Promise<PossibleArray<O, MediaType<O>>>;
export function openCropper(options: ImageOptions): Promise<Image>;
export function openCropper(options: CropperOptions): Promise<Image>;
export function clean(): Promise<void>;
export function cleanSingle(path: string): Promise<void>;

export interface ImageCropPicker {
openPicker<O extends Options>(options: O): Promise<PossibleArray<O, MediaType<O>>>;
openCamera<O extends Options>(options: O): Promise<PossibleArray<O, MediaType<O>>>;
openCropper(options: ImageOptions): Promise<Image>;
openCropper(options: CropperOptions): Promise<Image>;
clean(): Promise<void>;
cleanSingle(path: string): Promise<void>;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-image-crop-picker",
"version": "0.33.3",
"version": "0.33.4",
"description": "Select single or multiple images, with cropping option",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 2d834b4

Please sign in to comment.