From b931aa735fcbefe40eccd8344ae28ab6eec06930 Mon Sep 17 00:00:00 2001 From: Xuan Huang Date: Mon, 9 Aug 2021 15:44:32 -0700 Subject: [PATCH] Add Flow libdefs for `global` Summary: Changelog: [Internal] Currently, `global` is typed as `any` and any `global` properties accesses are untyped. This diff add a flow libdefs for the `global` object as a start point. Reviewed By: yungsters Differential Revision: D30000895 fbshipit-source-id: ab6988d01921a3c2a3434b534b2f69083570fb6d --- flow/global.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 flow/global.js diff --git a/flow/global.js b/flow/global.js new file mode 100644 index 00000000000000..8d7b7ee01c952f --- /dev/null +++ b/flow/global.js @@ -0,0 +1,21 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +/** + * `global` is a object containing all the global variables for React Native. + * + * NOTE: Consider cross-platform as well as JS environments compatibility + * when defining the types here. Consider both presence (`?`) as well as + * writeability (`+`) when defining types. + */ +declare var global: { + // Undeclared properties are implicitly `any`. + [string | symbol]: any, +};