mauricevancooten / react-anchor-link-smooth-scroll

React component for anchor links using the smooth scroll polyfill.
243 stars 31 forks source link

Typescript support? #29

Open kennycason opened 4 years ago

kennycason commented 4 years ago

Hi, I like the library however am unable to use it in my Typescript project. Any plan on adding the type files? Thanks!

luismramirezr commented 4 years ago

I don't know if this is totally right, but it may help you. Add it to your types folder.

declare module 'react-anchor-link-smooth-scroll' {
  interface Props {
    href: string;
    offset?: function | number;
    onClick?: (e: Event) => void;
    [key: string]: any;
  }

  export default class AnchorLink extends React.Component<Props> {}
}
kennycason commented 4 years ago

@luismramirezr Thanks, I'll give it a spin.

rramphal commented 4 years ago

@luismramirezr You should open a PR or submit your code to https://github.com/DefinitelyTyped/DefinitelyTyped!