From c7524b7b6fae90d9bd848c3413d59fd3361ccda4 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Fri, 11 Sep 2015 21:17:48 -0700 Subject: [PATCH] Add Flow type checking; React >= 0.13 --- .babelrc | 5 +++++ package.json | 5 +++-- src/modules/filterObjectProps/index.js | 6 +----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.babelrc b/.babelrc index 98a65280..6483c734 100644 --- a/.babelrc +++ b/.babelrc @@ -1,4 +1,9 @@ { + "env": { + "development": { + "plugins": [ "typecheck" ] + } + }, "optional": [ "es7.classProperties", "runtime" diff --git a/package.json b/package.json index 3878c125..5943c5fe 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dist" ], "scripts": { - "build": "rm -rf ./dist && webpack --config config/webpack.config.publish.js --sort-assets-by --progress", + "build": "rm -rf ./dist && NODE_ENV=publish webpack --config config/webpack.config.publish.js --sort-assets-by --progress", "dev": "webpack-dev-server --config config/webpack.config.example.js --inline --colors --quiet", "lint": "eslint config src", "prepublish": "npm run build", @@ -16,7 +16,7 @@ "test": "npm run specs && npm run lint" }, "dependencies": { - "react": "^0.13.3", + "react": ">=0.13.3", "react-swipeable": "^3.0.2", "react-tappable": "^0.6.0" }, @@ -25,6 +25,7 @@ "babel-core": "^5.8.23", "babel-eslint": "^4.1.1", "babel-loader": "^5.3.2", + "babel-plugin-typecheck": "^1.2.0", "babel-runtime": "^5.8.20", "css-loader": "^0.17.0", "eslint": "^1.3.1", diff --git a/src/modules/filterObjectProps/index.js b/src/modules/filterObjectProps/index.js index a168c3d1..255c389b 100644 --- a/src/modules/filterObjectProps/index.js +++ b/src/modules/filterObjectProps/index.js @@ -1,8 +1,4 @@ -function filterProps(obj, props, excluded = false) { - if (!Array.isArray(props)) { - throw new TypeError('props is not an Array') - } - +function filterProps(obj, props: Array, excluded = false) { const filtered = {} for (const prop in obj) { if (Object.prototype.hasOwnProperty.call(obj, prop)) {