diff --git a/.flowconfig b/.flowconfig index 8283bfcb..6a96f19a 100644 --- a/.flowconfig +++ b/.flowconfig @@ -20,4 +20,8 @@ [libs] +[lints] +ambiguous-object-type=error +deprecated-type=error + [options] diff --git a/package.json b/package.json index 3504023f..08d713b1 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "eslint-plugin-import": "^2.13.0", "eslint-plugin-jsx-a11y": "^6.1.0", "eslint-plugin-react": "^7.10.0", - "flow-bin": "^0.53.1", + "flow-bin": "^0.119.1", "flow-copy-source": "^1.1.0", "husky": "^0.14.3", "inject-loader": "^4.0.1", diff --git a/src/Motion.js b/src/Motion.js index de4c73dc..2513137b 100644 --- a/src/Motion.js +++ b/src/Motion.js @@ -18,12 +18,12 @@ import type { const msPerFrame = 1000 / 60; -type MotionState = { +type MotionState = {| currentStyle: PlainStyle, currentVelocity: Velocity, lastIdealStyle: PlainStyle, lastIdealVelocity: Velocity, -}; +|}; export default class Motion extends React.Component { static propTypes = { diff --git a/src/StaggeredMotion.js b/src/StaggeredMotion.js index 4ae84909..346d81a1 100644 --- a/src/StaggeredMotion.js +++ b/src/StaggeredMotion.js @@ -18,12 +18,12 @@ import type { const msPerFrame = 1000 / 60; -type StaggeredMotionState = { +type StaggeredMotionState = {| currentStyles: Array, currentVelocities: Array, lastIdealStyles: Array, lastIdealVelocities: Array, -}; +|}; function shouldStopAnimationAll( currentStyles: Array, diff --git a/src/TransitionMotion.js b/src/TransitionMotion.js index d23b252c..9511386a 100644 --- a/src/TransitionMotion.js +++ b/src/TransitionMotion.js @@ -201,13 +201,13 @@ function mergeAndSync( ]; } -type TransitionMotionDefaultProps = { +type TransitionMotionDefaultProps = {| willEnter: WillEnter, willLeave: WillLeave, didLeave: DidLeave, -}; +|}; -type TransitionMotionState = { +type TransitionMotionState = {| // list of styles, each containing interpolating values. Part of what's passed // to children function. Notice that this is // Array, without the wrapper that is {key: ..., @@ -222,7 +222,7 @@ type TransitionMotionState = { // the array that keeps track of currently rendered stuff! Including stuff // that you've unmounted but that's still animating. This is where it lives mergedPropsStyles: Array, -}; +|}; export default class TransitionMotion extends React.Component< TransitionProps, diff --git a/src/Types.js b/src/Types.js index 1d679ae6..d60b34cd 100644 --- a/src/Types.js +++ b/src/Types.js @@ -5,7 +5,7 @@ /* eslint-disable spaced-comment, no-undef */ /*:: import type {Element} from 'react'; -export type ReactElement = Element<*>; +export type ReactElement = Element; */ // === basic reused types === @@ -14,6 +14,7 @@ export type SpringHelperConfig = { stiffness?: number, damping?: number, precision?: number, + ... }; // the object returned by `spring(value, yourConfig)`. For internal usage only! export type OpaqueConfig = { @@ -21,48 +22,55 @@ export type OpaqueConfig = { stiffness: number, damping: number, precision: number, + ... }; // your typical style object given in props. Maps to a number or a spring config -export type Style = { [key: string]: number | OpaqueConfig }; +export type Style = { [key: string]: number | OpaqueConfig, ... }; // the interpolating style object, with the same keys as the above Style object, // with the values mapped to numbers, naturally -export type PlainStyle = { [key: string]: number }; +export type PlainStyle = { [key: string]: number, ... }; // internal velocity object. Similar to PlainStyle, but whose numbers represent // speed. Might be exposed one day. -export type Velocity = { [key: string]: number }; +export type Velocity = { [key: string]: number, ... }; // === Motion === -export type MotionProps = { +export type MotionProps = {| defaultStyle?: PlainStyle, style: Style, children: (interpolatedStyle: PlainStyle) => ReactElement, onRest?: () => void, -}; +|}; // === StaggeredMotion === -export type StaggeredProps = { +export type StaggeredProps = {| defaultStyles?: Array, styles: (previousInterpolatedStyles: ?Array) => Array