From 217f9fc253e9a9dd367c5960f1324fba685d8037 Mon Sep 17 00:00:00 2001 From: Tae Kim Date: Wed, 7 Aug 2019 16:15:08 -0700 Subject: [PATCH] Create conductor-animate types (#37431) Cleanup Add TS version Use interface over type Remove unnecessary semicolons Use TS version 2.8 --- .../conductor-animate-tests.tsx | 29 +++++++++++++++++ types/conductor-animate/index.d.ts | 32 +++++++++++++++++++ types/conductor-animate/tsconfig.json | 26 +++++++++++++++ types/conductor-animate/tslint.json | 1 + 4 files changed, 88 insertions(+) create mode 100644 types/conductor-animate/conductor-animate-tests.tsx create mode 100644 types/conductor-animate/index.d.ts create mode 100644 types/conductor-animate/tsconfig.json create mode 100644 types/conductor-animate/tslint.json diff --git a/types/conductor-animate/conductor-animate-tests.tsx b/types/conductor-animate/conductor-animate-tests.tsx new file mode 100644 index 0000000000..3d727a4012 --- /dev/null +++ b/types/conductor-animate/conductor-animate-tests.tsx @@ -0,0 +1,29 @@ +import * as React from 'react'; +import { Conductor, Animated } from 'conductor-animate'; + +// Define the Animation mapping +const animations = { + Fade: () =>
Fake Animation
, +}; + +// Define the configuration +const config = { + HeaderSection: { + animation: 'Fade', + duration: 500, + delay: 200, + }, +}; + +const App = () => { + // Render the Page w/ the Conductor and Animated + return ( + + +

This Header will fade in

+
+
+ ); +}; + +export default App; diff --git a/types/conductor-animate/index.d.ts b/types/conductor-animate/index.d.ts new file mode 100644 index 0000000000..028448a218 --- /dev/null +++ b/types/conductor-animate/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for conductor-animate 1.0 +// Project: https://github.com/TaeKimJR/conductor-animate#readme +// Definitions by: Tae Kim +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 +import * as React from 'react'; + +interface Animations { + [K: string]: React.ComponentClass | React.FunctionComponent; +} + +interface Config { + animation: string; +} + +interface AnimatedProps { + additional?: object; + children?: React.ReactNode | React.ReactNodeArray | null; + id: string; +} + +declare class Animated extends React.PureComponent { } + +interface ConductorProps { + animations: Animations; + children: React.ReactNode | React.ReactNodeArray; + config: { [K: string]: Config } | ((id: string, additional: object) => Config); +} + +declare class Conductor extends React.PureComponent { } + +export { Animated, Conductor }; diff --git a/types/conductor-animate/tsconfig.json b/types/conductor-animate/tsconfig.json new file mode 100644 index 0000000000..a37b42a2f8 --- /dev/null +++ b/types/conductor-animate/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "conductor-animate-tests.tsx" + ] +} diff --git a/types/conductor-animate/tslint.json b/types/conductor-animate/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/conductor-animate/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }