diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 00000000..e63dbf22 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,13 @@ +[ignore] +.*/__tests__/.* +.*/examples/.* +.*/performance/.* +.*/node_modules/animated/* + +[include] + +[libs] +types + +[options] +unsafe.enable_getters_and_setters=true diff --git a/package.json b/package.json index 6e31e3a8..6aee41ed 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "build:umd": "webpack --config webpack.config.js --sort-assets-by --progress", "deploy:examples": "git checkout gh-pages && rm -rf ./storybook && mv dist-examples storybook && git add -A && git commit -m \"Storybook deploy\" && git push origin gh-pages && git checkout -", "examples": "start-storybook -p 9001 -c ./examples/.storybook --dont-track", + "flow": "flow", "fmt": "find examples performance src -name '*.js' | grep -v -E '(node_modules|dist)' | xargs npm run fmt:cmd", "fmt:cmd": "prettier --print-width=100 --single-quote --write", "lint": "npm run lint:cmd -- examples performance src", diff --git a/types/create-react-class.js b/types/create-react-class.js new file mode 100644 index 00000000..01780570 --- /dev/null +++ b/types/create-react-class.js @@ -0,0 +1,6 @@ +// flow-typed signature: 121e589c9be7dac408c14a02e88287fa +// flow-typed version: a1a20d4928/create-react-class_v15.x.x/flow_>=v0.41.x + +declare module 'create-react-class' { + declare var exports: React$CreateClass; +} diff --git a/types/fbjs.js b/types/fbjs.js new file mode 100644 index 00000000..37248484 --- /dev/null +++ b/types/fbjs.js @@ -0,0 +1,20 @@ +/** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +declare module 'fbjs/lib/invariant' { + declare function exports( + condition: any, + message: string, + ...args: Array + ): void; +} + +declare module 'fbjs/lib/nullthrows' { + declare function exports(value: ?T): T; +} diff --git a/types/prop-types.js b/types/prop-types.js new file mode 100644 index 00000000..113b0b5c --- /dev/null +++ b/types/prop-types.js @@ -0,0 +1,34 @@ +// flow-typed signature: 3eaa1f24c7397b78a7481992d2cddcb2 +// flow-typed version: a1a20d4928/prop-types_v15.x.x/flow_>=v0.41.x + +type $npm$propTypes$ReactPropsCheckType = ( + props: any, + propName: string, + componentName: string, + href?: string) => ?Error; + +declare module 'prop-types' { + declare var array: React$PropType$Primitive>; + declare var bool: React$PropType$Primitive; + declare var func: React$PropType$Primitive; + declare var number: React$PropType$Primitive; + declare var object: React$PropType$Primitive; + declare var string: React$PropType$Primitive; + declare var any: React$PropType$Primitive; + declare var arrayOf: React$PropType$ArrayOf; + declare var element: React$PropType$Primitive; /* TODO */ + declare var instanceOf: React$PropType$InstanceOf; + declare var node: React$PropType$Primitive; /* TODO */ + declare var objectOf: React$PropType$ObjectOf; + declare var oneOf: React$PropType$OneOf; + declare var oneOfType: React$PropType$OneOfType; + declare var shape: React$PropType$Shape; + + declare function checkPropTypes( + propTypes: $Subtype<{[_: $Keys]: $npm$propTypes$ReactPropsCheckType}>, + values: V, + location: string, + componentName: string, + getStack: ?(() => ?string) + ) : void; +}