diff --git a/types/react-mic/index.d.ts b/types/react-mic/index.d.ts new file mode 100644 index 0000000000..b0e6f81187 --- /dev/null +++ b/types/react-mic/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for react-mic 12.4 +// Project: https://hackingbeauty.github.io/react-mic +// Definitions by: mikaello +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as React from 'react'; + +/** + * Record a user's voice and display as an oscillation (or frequency bars). + */ +export class ReactMic extends React.PureComponent {} + +export interface ReactMicProps { + /** Set to true to begin recording */ + record?: boolean; + + /** Available in React-Mic-Plus upgrade only */ + pause?: boolean; + + visualSetting?: 'sinewave' | 'frequencyBars'; + + className?: string; + + /** Callback that is executed when audio stops recording */ + onStop?: (recordedData: Blob) => void; + + /** Callback that is executed when chunk of audio is available */ + onData?: (recordedData: Blob) => void; + + /** Sound wave color */ + strokeColor?: string; + + /** Background color */ + backgroundColor?: string; +} diff --git a/types/react-mic/react-mic-tests.tsx b/types/react-mic/react-mic-tests.tsx new file mode 100644 index 0000000000..b651fcdbe4 --- /dev/null +++ b/types/react-mic/react-mic-tests.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; + +import { ReactMic } from 'react-mic'; + +class ReactMicTest extends React.Component { + render() { + return ( + console.log(data)} + onData={data => console.log(data)} + strokeColor="#000000" + backgroundColor="#FF4081" + /> + ); + } +} diff --git a/types/react-mic/tsconfig.json b/types/react-mic/tsconfig.json new file mode 100644 index 0000000000..5751ca1667 --- /dev/null +++ b/types/react-mic/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-mic-tests.tsx" + ] +} diff --git a/types/react-mic/tslint.json b/types/react-mic/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-mic/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }