compulim/react-say

Use with TypeScript

dohomi opened this issue · 2 comments

Hello,

I would like to know if there is a documentation about to use this with TypeScript?

Thanks

Check out tts-react for TypeScript support.

tsconfig.json

"compilerOptions": {
    "paths": {
      "web-speech-cognitive-services": ["./index.d.ts"],
      "web-speech-cognitive-services/lib/SpeechServices": ["./index.d.ts"],
      "'react-say'": ["./index.d.ts"]
    }
}

index.d.ts

declare module 'react-say' {
  interface SayProps {
    text: string;
    speechSynthesis: SpeechSynthesis;
    speechSynthesisUtterance: SpeechSynthesisUtterance;
    lang?: string;
    pitch?: number;
    rate?: number;
    speak?: string;
    volume?: number;
    onEnd?: () => void;
    onEror?: () => void;
    onStart?: () => void;
  }

  export default function Say(props: SayProps): JSX.Element;
}

more info about types:
https://github.com/compulim/react-say/tree/master/packages/component/src