From 79a9103a5870e06072a780ac599c938689548383 Mon Sep 17 00:00:00 2001 From: Constantine Lebedev Date: Tue, 28 Aug 2018 17:12:35 +0200 Subject: [PATCH] Add typings for react-sound package --- types/react-sound/index.d.ts | 34 +++++++++++++++++++++++++ types/react-sound/react-sound-tests.tsx | 33 ++++++++++++++++++++++++ types/react-sound/tsconfig.json | 26 +++++++++++++++++++ types/react-sound/tslint.json | 1 + 4 files changed, 94 insertions(+) create mode 100644 types/react-sound/index.d.ts create mode 100644 types/react-sound/react-sound-tests.tsx create mode 100644 types/react-sound/tsconfig.json create mode 100644 types/react-sound/tslint.json diff --git a/types/react-sound/index.d.ts b/types/react-sound/index.d.ts new file mode 100644 index 0000000000..4670feb5f9 --- /dev/null +++ b/types/react-sound/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for react-sound 1.2 +// Project: https://github.com/leoasis/react-sound +// Definitions by: Konstantin Lebedev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +declare namespace ReactSound { + type PlayStatus = 'PLAYING' | 'STOPPED' | 'PAUSED'; + + interface ReactSoundProps { + url: string; + playStatus: PlayStatus; + playFromPosition?: number; + position?: number; + volume?: number; + playbackRate?: number; + autoLoad?: boolean; + loop?: boolean; + onError?: () => void; + onLoading?: () => void; + onLoad?: () => void; + onPlaying?: () => void; + onPause?: () => void; + onResume?: () => void; + onStop?: () => void; + onFinishedPlaying?: () => void; + onBufferChange?: () => void; + } +} + +declare const ReactSound: React.ComponentClass; +export = ReactSound; diff --git a/types/react-sound/react-sound-tests.tsx b/types/react-sound/react-sound-tests.tsx new file mode 100644 index 0000000000..2775ac607a --- /dev/null +++ b/types/react-sound/react-sound-tests.tsx @@ -0,0 +1,33 @@ +import ReactSound from "react-sound"; +import * as React from "react"; + +const ReactSoundRequiredOptions: JSX.Element = ( + +); + +const callbackFn = () => ({}); + +const ReactSoundAllOptions: JSX.Element = ( + +); diff --git a/types/react-sound/tsconfig.json b/types/react-sound/tsconfig.json new file mode 100644 index 0000000000..e755ca5056 --- /dev/null +++ b/types/react-sound/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "react-sound-tests.tsx" + ] +} diff --git a/types/react-sound/tslint.json b/types/react-sound/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-sound/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }