Set up flow config; add third party libdefs

This commit is contained in:
Peggy Rayzis
2017-05-04 10:58:30 -04:00
committed by Nicolas Gallagher
parent 6b85f5a22a
commit be3c78f317
5 changed files with 74 additions and 0 deletions

13
.flowconfig Normal file
View File

@@ -0,0 +1,13 @@
[ignore]
.*/__tests__/.*
.*/examples/.*
.*/performance/.*
.*/node_modules/animated/*
[include]
[libs]
types
[options]
unsafe.enable_getters_and_setters=true

View File

@@ -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",

View File

@@ -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;
}

20
types/fbjs.js Normal file
View File

@@ -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<T>(
condition: any,
message: string,
...args: Array<any>
): void;
}
declare module 'fbjs/lib/nullthrows' {
declare function exports<T>(value: ?T): T;
}

34
types/prop-types.js Normal file
View File

@@ -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<Array<any>>;
declare var bool: React$PropType$Primitive<boolean>;
declare var func: React$PropType$Primitive<Function>;
declare var number: React$PropType$Primitive<number>;
declare var object: React$PropType$Primitive<Object>;
declare var string: React$PropType$Primitive<string>;
declare var any: React$PropType$Primitive<any>;
declare var arrayOf: React$PropType$ArrayOf;
declare var element: React$PropType$Primitive<any>; /* TODO */
declare var instanceOf: React$PropType$InstanceOf;
declare var node: React$PropType$Primitive<any>; /* 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<V>(
propTypes: $Subtype<{[_: $Keys<V>]: $npm$propTypes$ReactPropsCheckType}>,
values: V,
location: string,
componentName: string,
getStack: ?(() => ?string)
) : void;
}