Add fbjs definitions to flow config

Reviewed By: zertosh

Differential Revision: D4291805

fbshipit-source-id: 3dcb8ffe6132bd04a3048edae64e9d273c2dcae4
This commit is contained in:
David Aurelio 2016-12-08 02:32:22 -08:00 committed by Facebook Github Bot
parent b203343b81
commit 6786cbd3e4
3 changed files with 18 additions and 2 deletions

16
flow/fbjs.js Normal file
View File

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

View File

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

View File

@ -139,5 +139,5 @@ exports.forOptimization =
collectDependencies(
ast,
new ProdReplacement(names),
dependencyMapName && types.identifier(dependencyMapName),
dependencyMapName ? types.identifier(dependencyMapName) : undefined,
);