Skip to content

Commit

Permalink
[Typings] Fix size options units not being an optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesssooi committed Jan 29, 2018
1 parent 99212da commit 0e5b649
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ declare class Croppr {
constructor(element: string | HTMLElement, options?: Croppr.CropprOptions, deferred?: boolean)

/** Gets the value of the crop region */
getValue(mode?: 'real' | 'ratio' | 'raw'): Croppr.CropprValue
getValue(mode?: 'real' | 'ratio' | 'raw'): Croppr.CropValue

/** Destroys the Croppr instance */
destroy(): void
Expand All @@ -39,21 +39,27 @@ declare namespace Croppr {

export interface CropprOptions {
aspectRatio?: number;
maxSize?: [number, number, '%' | 'px'];
minSize?: [number, number, '%' | 'px'];
startSize?: [number, number, '%' | 'px'];
onCropStart?(data: Croppr.CropprValue): void;
onCropMove?(data: Croppr.CropprValue): void;
onCropEnd?(data: Croppr.CropprValue): void;
maxSize?: SizeValue;
minSize?: SizeValue;
startSize?: SizeValue;
onCropStart?(data: CropValue): void;
onCropMove?(data: CropValue): void;
onCropEnd?(data: CropValue): void;
onInitialize?(instance: Croppr): void;
returnMode?: 'real' | 'ratio' | 'raw';
}

export interface CropprValue {
export interface CropValue {
x: number;
y: number;
width: number;
height: number
}

export interface SizeValue extends Array<string | number> {
0: number,
1: number,
2?: 'px' | '%'
}

}

0 comments on commit 0e5b649

Please sign in to comment.