From ce5ef64de9d3dd6051504a6cf612c11bbb347e54 Mon Sep 17 00:00:00 2001 From: Tim Ittermann Date: Mon, 2 Dec 2019 21:37:28 +0100 Subject: [PATCH] Add Types for react-countdown-circle-timer 1.0.3 (#40724) * Add Types for react-countdown-circle-timer 1.0.3 * Fixed Definition * Fixed Test --- types/react-countdown-circle-timer/index.d.ts | 28 +++++++++++++++++++ .../react-countdown-circle-timer-tests.tsx | 22 +++++++++++++++ .../tsconfig.json | 24 ++++++++++++++++ .../react-countdown-circle-timer/tslint.json | 1 + 4 files changed, 75 insertions(+) create mode 100644 types/react-countdown-circle-timer/index.d.ts create mode 100644 types/react-countdown-circle-timer/react-countdown-circle-timer-tests.tsx create mode 100644 types/react-countdown-circle-timer/tsconfig.json create mode 100644 types/react-countdown-circle-timer/tslint.json diff --git a/types/react-countdown-circle-timer/index.d.ts b/types/react-countdown-circle-timer/index.d.ts new file mode 100644 index 0000000000..9e7ec0df9a --- /dev/null +++ b/types/react-countdown-circle-timer/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for react-countdown-circle-timer 1.0 +// Project: https://github.com/vydimitrov/react-countdown-circle-timer +// Definitions by: Tim Ittermann +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.6 + +import { Component, ReactNode } from 'react'; + +export type ColorType = ReadonlyArray<[ string, number? ]>; +export type StrokeLinecapType = "round" | "square"; +export type RenderTimeFunctionType = (remainingTime: number, elapsedTime: number, isPlaying: boolean) => ReactNode; +export type OnCompleteFunctionType = () => [boolean, number] | undefined | void; + +export class CountdownCircleTimer extends Component {} + +export interface Props { + durationSeconds: number; + colors: ColorType; + size?: number; + strokeWidth?: number; + strokeLinecap?: StrokeLinecapType; + trailColor?: string; + isPlaying?: boolean; + isLinearGradient?: boolean; + gradientUniqueKey?: string; + renderTime?: RenderTimeFunctionType; + onComplete?: OnCompleteFunctionType; +} diff --git a/types/react-countdown-circle-timer/react-countdown-circle-timer-tests.tsx b/types/react-countdown-circle-timer/react-countdown-circle-timer-tests.tsx new file mode 100644 index 0000000000..2126bbad7a --- /dev/null +++ b/types/react-countdown-circle-timer/react-countdown-circle-timer-tests.tsx @@ -0,0 +1,22 @@ +import * as React from "react"; +import { CountdownCircleTimer } from "react-countdown-circle-timer"; + +const Test: React.FC = () => { + return

Test

} + onComplete={() => { }} + />; +}; diff --git a/types/react-countdown-circle-timer/tsconfig.json b/types/react-countdown-circle-timer/tsconfig.json new file mode 100644 index 0000000000..1d82b2a6aa --- /dev/null +++ b/types/react-countdown-circle-timer/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-countdown-circle-timer-tests.tsx" + ] +} diff --git a/types/react-countdown-circle-timer/tslint.json b/types/react-countdown-circle-timer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-countdown-circle-timer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }