diff --git a/flow/fbjs.js b/flow/fbjs.js new file mode 100644 index 000000000..45cbe8abc --- /dev/null +++ b/flow/fbjs.js @@ -0,0 +1,16 @@ +/** + * 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/local-cli/server/util/inspectorProxy.js b/local-cli/server/util/inspectorProxy.js index 1cabb62e5..7d29721a9 100644 --- a/local-cli/server/util/inspectorProxy.js +++ b/local-cli/server/util/inspectorProxy.js @@ -197,7 +197,7 @@ class Device { _handleWrappedEvent(event: WrappedEvent) { const payload = nullthrows(event.payload); - const socket = this._connections.get(payload.pageId); + const socket = this._connections.get(nullthrows(payload.pageId)); if (!socket) { console.error('Invalid pageId from device:', payload.pageId); return; diff --git a/packager/react-packager/src/ModuleGraph/worker/collect-dependencies.js b/packager/react-packager/src/ModuleGraph/worker/collect-dependencies.js index df82ea23c..37e447259 100644 --- a/packager/react-packager/src/ModuleGraph/worker/collect-dependencies.js +++ b/packager/react-packager/src/ModuleGraph/worker/collect-dependencies.js @@ -139,5 +139,5 @@ exports.forOptimization = collectDependencies( ast, new ProdReplacement(names), - dependencyMapName && types.identifier(dependencyMapName), + dependencyMapName ? types.identifier(dependencyMapName) : undefined, );