Typescript types
StefanoSega opened this issue · 4 comments
Hello!
First of all, congratulation for this great component!
Do you have plans to add TS types to it on @types/react-scroll-sync
?
I don’t plan anything for this repo. If you’re interested in adding types, I’d be happy to merge such a PR but I think it will go into another repo.
@StefanoSega here's a very scrappy workaround:
// global.d.ts
declare module 'react-scroll-sync' {
import * as React from 'react';
export const ScrollSync: React.FC;
export const ScrollSyncPane: React.FC;
}
TSC should be able to pick it up (it automatically looks for and includes any global.d.ts
files for module definitions, etc). You can add prop types if you use them (I don't, so there aren't any in that typing).
If you're going to add types I recommend adding it as an index.d.ts and including it in the package.json file under the types
property. Using global can mess with other types and have unintended side effects.
But also, these types may best live in DT
npm i --save-dev @types/react-scroll-sync
works now