You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Types reexported from react-onclickoutside cannot be used unless @types/react-onclickoutside is installed as well as react-datepicker.
This means that excludeScrollbar is not correctly typed as a boolean, and TypeScript does not cleanly compile unless the skipLibCheck compiler option is true.
TypeScript fails with:
node_modules/react-datepicker/dist/index.d.ts(2,60): error TS7016: Could not find a declaration file for module 'react-onclickoutside'. '/repo/UI/Website/node_modules/react-onclickoutside/dist/react-onclickoutside.cjs.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/react-onclickoutside` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-onclickoutside';`
I don't know, it's related or no, but I got that error on build with new one below
node_modules/react-datepicker/dist/calendar.d.ts:10:26 - error TS2307: Cannot find module 'date-fns/types' or its corresponding type declarations.
10 import type { Day } from "date-fns/types";
I can't build my UI lib that depends on [email protected] due to missing @types/react-onlclickoutside. Version 7.3.0 depends on react-onlickoutside itself in package.json. In main branch in package.json that dependency is missing so probably with new version it will be fixed.
Describe the bug
Types reexported from
react-onclickoutside
cannot be used unless@types/react-onclickoutside
is installed as well asreact-datepicker
.This means that
excludeScrollbar
is not correctly typed as aboolean
, and TypeScript does not cleanly compile unless theskipLibCheck
compiler option istrue
.TypeScript fails with:
To Reproduce
See CodeSandbox; direct link to index.d.ts.
Expected behavior
excludeScrollbar
is a booleanScreenshots
Desktop (please complete the following information):
N/A
Smartphone (please complete the following information):
N/A
Additional context
I think the simplest fix here is to add
@types/react-onclickoutside
as a dependency rather than dev dependency.An alternative fix is to redefine the types from
@types/react-onclickoutside
inline without importing them fromreact-onclickoutside
.Two workarounds are:
skipLibCheck
TypeScript compiler options – this allows TypeScript to compile but does not correct the type ofexcludeScrollbar
.npm install --save-dev @types/react-onclickoutside
to include the missing types.The text was updated successfully, but these errors were encountered: