Merge pull request #32737 from j-em/master

Add typings for react-motion-loop.
This commit is contained in:
Nathan Shively-Sanders
2019-02-04 10:55:48 -08:00
committed by GitHub
4 changed files with 56 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for react-motion-loop 2.0
// Project: https://github.com/nkbt/react-motion-loop
// Definitions by: Jeremy Allard <https://github.com/j-em>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
import { Component, ReactElement } from "react";
import { MotionProps, PlainStyle, Style } from "react-motion";
interface ReactMotionLoopProps extends Partial<MotionProps> {
styleFrom: Style;
styleTo: Style;
children?: (interpolatedStyle: PlainStyle) => ReactElement<any>;
}
export class ReactMotionLoop extends Component<ReactMotionLoopProps> {}
export as namespace ReactMotionLoop;
@@ -0,0 +1,16 @@
import * as React from "react";
import { ReactMotionLoop } from "react-motion-loop";
import { spring } from "react-motion";
const TestComponent: React.FunctionComponent<never> = props => (
<ReactMotionLoop
styleFrom={{ rotate: spring(0) }}
styleTo={{ rotate: spring(180) }}
>
{interpolatedStyle => (
<p
style={{ transform: `rotate( ${interpolatedStyle.rotate}deg)` }}
/>
)}
</ReactMotionLoop>
);
+17
View File
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "react-motion-loop-tests.tsx"]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"strict-export-declare-modifiers": false
}
}