diff --git a/package.json b/package.json index e1c2156c4..814c5e2d7 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "jsnext:main": "dist/es/index.js", "license": "MIT", "scripts": { - "build:types": "flow-copy-source --ignore \"**/*.{jest,e2e,example}.js\" source/WindowScroller dist/es/WindowScroller", + "build:types": "flow-copy-source --ignore \"**/*.{jest,e2e,example}.js\" source/WindowScroller dist/es/WindowScroller && flow-copy-source --ignore \"**/*.{jest,e2e,example}.js\" source/AutoSizer dist/es/AutoSizer ", "build": "npm run build:commonjs && npm run build:css && npm run build:es && npm run build:demo && npm run build:umd", "build:commonjs": "npm run clean:commonjs && cross-env NODE_ENV=production cross-env BABEL_ENV=commonjs babel source --out-dir dist/commonjs", "build:css": "postcss source/styles.css -o styles.css --use autoprefixer", diff --git a/source/AutoSizer/AutoSizer.js b/source/AutoSizer/AutoSizer.js index 296b4ca33..f6ad9cb00 100644 --- a/source/AutoSizer/AutoSizer.js +++ b/source/AutoSizer/AutoSizer.js @@ -1,13 +1,16 @@ /** @flow */ -import type {Size} from './types'; - import * as React from 'react'; import createDetectElementResize from '../vendor/detectElementResize'; +type Size = { + height: number, + width: number, +}; + type Props = { /** Function responsible for rendering children.*/ - children: (warams: Size) => React.Element<*>, + children: Size => React.Element<*>, /** Default height to use for initial render; useful for SSR */ defaultHeight?: number, @@ -25,7 +28,7 @@ type Props = { nonce?: string, /** Callback to be invoked on-resize */ - onResize: (params: Size) => void, + onResize: Size => void, }; type State = { @@ -92,8 +95,8 @@ export default class AutoSizer extends React.PureComponent { // Outer div should not force width/height since that may prevent containers from shrinking. // Inner component should overflow and use calculated width/height. // See issue #68 for more information. - const outerStyle: any = {overflow: 'visible'}; - const childParams: any = {}; + const outerStyle: Object = {overflow: 'visible'}; + const childParams: Object = {}; if (!disableHeight) { outerStyle.height = 0; @@ -159,7 +162,7 @@ export default class AutoSizer extends React.PureComponent { } }; - _setRef = (autoSizer: HTMLElement | null) => { + _setRef = (autoSizer: ?HTMLElement) => { this._autoSizer = autoSizer; }; } diff --git a/source/AutoSizer/index.js b/source/AutoSizer/index.js index e307710fb..27514059c 100644 --- a/source/AutoSizer/index.js +++ b/source/AutoSizer/index.js @@ -1,6 +1,4 @@ // @flow -export type {Size} from './types'; - export {default} from './AutoSizer'; export {default as AutoSizer} from './AutoSizer'; diff --git a/source/AutoSizer/types.js b/source/AutoSizer/types.js deleted file mode 100644 index 5151542dd..000000000 --- a/source/AutoSizer/types.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow - -export type Size = { - height: number, - width: number, -};