Added react-fade-in Type Definitions (#41182)

* added react-fade-in type definitions

* added version in

* added type definitions for react-hook-mousetrap

* resolved prefer-declare-function error
This commit is contained in:
Barry Michael Doyle
2019-12-27 09:09:48 -06:00
committed by Andrew Branch
parent 05e0a74be3
commit ba94ba69b1
8 changed files with 139 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for react-fade-in 0.1
// Project: github.com/gkaemmer/react-fade-in
// Definitions by: Barry Michael Doyle <https://github.com/barrymichaeldoyle>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
import { ComponentClass, ReactNode } from 'react';
/**
* Props for a FadeIn component.
*/
export interface FadeInProps {
children?: ReactNode;
className?: string;
/**
* Default: 50. Delay between each child's animation in milliseconds.
*/
delay?: number;
/**
* Default: 400. Duration of each child's animation in milliseconds.
*/
transitionDuration?: number;
}
/**
* Visually animates content on render with FadeIn.js
*/
declare const FadeIn: ComponentClass<FadeInProps>;
export default FadeIn;
@@ -0,0 +1,40 @@
import * as React from 'react';
import FadeIn from 'react-fade-in';
export const _ = () => (
<>
<FadeIn />
<FadeIn>
<div>Element 1</div>
<div>Element 2</div>
<div>Element 3</div>
<div>Element 4</div>
<div>Element 5</div>
<div>Element 6</div>
</FadeIn>
<FadeIn className="typescript">
<div>Element 1</div>
<div>Element 2</div>
<div>Element 3</div>
<div>Element 4</div>
<div>Element 5</div>
<div>Element 6</div>
</FadeIn>
<FadeIn delay={60}>
<div>Element 1</div>
<div>Element 2</div>
<div>Element 3</div>
<div>Element 4</div>
<div>Element 5</div>
<div>Element 6</div>
</FadeIn>
<FadeIn transitionDuration={500}>
<div>Element 1</div>
<div>Element 2</div>
<div>Element 3</div>
<div>Element 4</div>
<div>Element 5</div>
<div>Element 6</div>
</FadeIn>
</>
);
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"jsx": "react",
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-fade-in-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for react-hook-mousetrap 2.0
// Project: https://github.com/olup/react-hook-mousetrap
// Definitions by: Barry Michael Doyle <https://github.com/barrymichaeldoyle>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
declare function useMousetrap(keys: string | string[], callback: () => void): void;
export default useMousetrap;
@@ -0,0 +1,8 @@
import useMousetrap from 'react-hook-mousetrap';
export const _ = () => {
useMousetrap('down', () => console.log('down arrow pressed'));
useMousetrap(['left', 'right'], () => console.log('left or right arrow pressed'));
return null;
};
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"jsx": "react",
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-hook-mousetrap-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }