react-screen-capture icon indicating copy to clipboard operation
react-screen-capture copied to clipboard

Return `void` instead of `null`

Open kkosmowski opened this issue 2 years ago • 0 comments

Hey, I just installed this library.

First thing I noticed, I get type mismatch when I create a handler like this:

const handleStartCapture = () => {};

Turns out the interface for ScreenCapture props is this?:

interface Props {
    onStartCapture: () => null;
    onEndCapture: (url: string) => null;
}

I suggest changing return type of null to void, otherwise we are forced to return a value even if we don't want to.

Additionally, the example in Readme and in npm page does not present onStartCapture as required attribute, so it would be nice to update the example.

kkosmowski avatar Mar 25 '22 10:03 kkosmowski