[react-cropper] Made ref property optional (#35259)

* [react-cropper] Made ref property optional

* Add missing semicolon
This commit is contained in:
Walter Barbagallo 2019-05-08 20:16:31 +02:00 committed by Jesse Trinity
parent 82d9295a46
commit 14c84d853f
2 changed files with 4 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import * as React from 'react';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export interface ReactCropperProps extends cropperjs.CropperOptions, Omit<React.HTMLProps<HTMLImageElement>, 'data' | 'ref'> {
ref: string | ((cropper: null | ReactCropper) => any);
ref?: string | ((cropper: null | ReactCropper) => any);
}
interface ReactCropper extends cropperjs {} // tslint:disable-line no-empty-interface

View File

@ -24,7 +24,7 @@ class Demo extends React.Component {
}
function testCropperRef() {
<Cropper
const refIsWorking = <Cropper
ref={(el: Cropper) => {
// $ExpectError el can be null
el.getCroppedCanvas();
@ -36,4 +36,6 @@ function testCropperRef() {
}
}}
/>;
const refIsOptional = <Cropper />;
}