DefinitelyTyped/types/react-cropper/index.d.ts
Harald Friessnegger 234b6171fc
react-cropper: support ref prop created with useRef hook (#42801)
* support useRef hook

allows to also pass refs created with the `useRef` hook. see https://github.com/roadmanfong/react-cropper/issues/134#issuecomment-593984770

* use same cropperjs version as current react-cropper release

* update interface def and tests
2020-03-27 13:12:34 -04:00

23 lines
955 B
TypeScript

// Type definitions for react-cropper 1.3
// Project: https://github.com/roadmanfong/react-cropper, http://roadmanfong.github.io/react-cropper
// Definitions by: Stepan Mikhaylyuk <https://github.com/stepancar>
// Walter Barbagallo <https://github.com/bwlt>
// Harald Friessnegger <https://github.com/frisi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 3.7
import Cropper from 'cropperjs';
import * as React from 'react';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
interface ReactCropperProps extends Cropper.Options, Omit<React.HTMLProps<HTMLImageElement>, 'data' | 'ref'> {
ref?: React.LegacyRef<ReactCropper>;
}
interface ReactCropper extends Cropper {} // tslint:disable-line no-empty-interface
declare class ReactCropper extends React.Component<ReactCropperProps> {
on(eventname: string, callback: () => void): void;
}
export default ReactCropper;