web-ridge / react-native-paper-dates

Smooth and fast cross platform Material Design date and time picker for React Native Paper
https://www.reactnativepaperdates.com
MIT License
637 stars 161 forks source link

Typescript errors from this library #382

Closed CommanderRedYT closed 1 month ago

CommanderRedYT commented 2 months ago

I know this is not that much a thing about this library, but it is the only one causing me issues with typechecking.

I have a react native app using this library. When I run tsc --project tsconfig.json --pretty --noEmit --skipLibCheck, I get errors from only this library inside the node_modules folder.

$ tsc --project tsconfig.json --pretty --noEmit --skipLibCheck
node_modules/react-native-paper-dates/src/Date/Calendar.tsx:16:19 - error TS7016: Could not find a declaration file for module 'color'. '/home/user/bla/node_modules/color/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/color` if it exists or add a new declaration (.d.ts) file containing `declare module 'color';`

16 import Color from 'color'
                     ~~~~~~~

node_modules/react-native-paper-dates/src/Date/Swiper.tsx:106:13 - error TS2812: Property 'scrollTo' does not exist on type 'HTMLDivElement'. Try changing the 'lib' compiler option to include 'dom'.

106     element.scrollTo({
                ~~~~~~~~

I tried upgrading this library and/or typescript to their newest versions, but nothing worked... Even when I install the @types/color package, the error is still here...

iM-GeeKy commented 1 month ago

Hi @CommanderRedYT, I'd recommend adding "exclude": ["node_modules"] to your tsconfig.json. It is recommended to exclude it anyways.

CommanderRedYT commented 1 month ago

Hi @iM-GeeKy , I already have that.