react-image-crop
react-image-crop copied to clipboard
Codesandbox Demo Typescript Errors
FYI, when pasting the Codesandbox Demo code into a new React 18.2 / Typescript 4.7.4 project, a number of typescript errors are thrown. Many of these are easily fixed, but this one is giving me problems:
In useDebounceEffect:
const t = setTimeout(() => {
fn.apply(undefined, deps)
}, waitTime)
The deps is throwing the following error: Argument of type 'DependencyList | undefined' is not assignable to parameter of type '[]'. Type 'undefined' is not assignable to type '[]'.ts(2345).
I tried protecting against deps being undefined by doing: if(deps!==undefined) fn.apply(undefined,deps), but that only results in this error: Argument of type 'DependencyList | undefined' is not assignable to parameter of type '[]'. Type 'undefined' is not assignable to type '[]'.ts(2345)
Any help properly typing deps would be appreciated!