react-typewriter-effect icon indicating copy to clipboard operation
react-typewriter-effect copied to clipboard

Support for typescript

Open nairo-mudumane opened this issue 3 years ago • 2 comments

Is there a way to get the eclaration file for this module?

nairo-mudumane avatar Apr 29 '22 08:04 nairo-mudumane

Hey, I also needed typescript support and after not finding it I decided to make one myself. Since the author has not answered the issue I'll leave my React Typewriter component fully compatible with Typescript and React 18.0+ here: npm i react-ts-typewriter

gerardmarquinarubio avatar Jun 22 '22 08:06 gerardmarquinarubio

I am also using this package with a typescript, so I defined the type temporarily as below.

// types/index.d.ts

declare module "react-typewriter-effect" {
  interface TypeWriterEffectProps {
    text?: string;
    multiText?: string[];
    multiTextDelay?: number;
    multiTextLoop?: boolean;
    typeSpeed?: number;
    startDelay?: number;
    hideCursorAfterText?: boolean;
    cursorColor?: string;
    textStyle?: React.CSSProperties;
    scrollArea?: Element | Document | Window;
  }

  export default class TypeWriterEffect extends React.Component<
    TypeWriterEffectProps,
    any
  > {}
}

limitkr avatar Jun 26 '22 14:06 limitkr