react-scroll-sync icon indicating copy to clipboard operation
react-scroll-sync copied to clipboard

Typescript types

Open StefanoSega opened this issue 6 years ago • 4 comments
trafficstars

Hello!

First of all, congratulation for this great component!

Do you have plans to add TS types to it on @types/react-scroll-sync?

StefanoSega avatar Nov 24 '18 08:11 StefanoSega

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.

okonet avatar Nov 25 '18 18:11 okonet

@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).

nicholaschiang avatar Jul 30 '20 17:07 nicholaschiang

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

Ethan-Arrowood avatar Aug 04 '20 16:08 Ethan-Arrowood

npm i --save-dev @types/react-scroll-sync works now

nosovsh avatar Dec 21 '21 16:12 nosovsh