responsive: Namespace '_' has no exported member 'Cancelable'
With @visx/responsive 1.3.0, I started getting the following error:
node_modules/@visx/responsive/lib/enhancers/withParentSize.d.ts:30:40 - error TS2694: Namespace '_' has no exported member 'Cancelable'.
30 }) => void) & import("lodash").Cancelable;
~~~~~~~~~~
node_modules/@visx/responsive/lib/enhancers/withParentSize.d.ts:66:40 - error TS2694: Namespace '_' has no exported member 'Cancelable'.
66 }) => void) & import("lodash").Cancelable;
~~~~~~~~~~
node_modules/@visx/responsive/lib/enhancers/withParentSizeModern.d.ts:35:40 - error TS2694: Namespace '_' has no exported member 'Cancelable'.
35 }) => void) & import("lodash").Cancelable;
~~~~~~~~~~
node_modules/@visx/responsive/lib/enhancers/withParentSizeModern.d.ts:71:40 - error TS2694: Namespace '_' has no exported member 'Cancelable'.
71 }) => void) & import("lodash").Cancelable;
~~~~~~~~~~
node_modules/@visx/responsive/lib/enhancers/withScreenSize.d.ts:20:49 - error TS2694: Namespace '_' has no exported member 'Cancelable'.
20 resize: (() => void) & import("lodash").Cancelable;
~~~~~~~~~~
node_modules/@visx/responsive/lib/enhancers/withScreenSize.d.ts:49:49 - error TS2694: Namespace '_' has no exported member 'Cancelable'.
49 resize: (() => void) & import("lodash").Cancelable;
~~~~~~~~~~
It looks to be an incompatibility with the @types/lodash versioning. The @types/loadash package removed Cancelable in version 4.14.161, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/47166 and https://github.com/DefinitelyTyped/DefinitelyTyped/commit/93d8f9d7102925e1a39852627465a44a0ff670cf
For visx, yarn.lock contains versions 4.14.154 and 4.14.160 (https://github.com/airbnb/visx/blob/master/yarn.lock#L3579) both of which are before Cancelable is removed. Thus the build created and included in @visx/responsive package on npm refrences the Cancelable type, as you can see in the errors above.
The problem is that the @visx/responsive package.json contains a bound of ^4.14.146 (https://github.com/airbnb/visx/blob/v1.3.0/packages/visx-responsive/package.json#L31) and because this is a greater or equal condition, for me yarn resolves this to 4.14.165, which doesn't contain the Cancelable type and thus get the error above.
I can fix it by specifying 4.14.160 (the last with Cancelable) in my own package.json in the resolutions section.
Visx should either update everything to @types/lodash at least 4.14.161 everywhere in which case the build will use DebouncedFunc<T> instead of Cancelable, or @visx/responsive should be updated to have an upper bound of 4.14.160.