mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
20d9d3aa6a
Summary:
We are working on making the empty object literal `{}` have the type `{}` - i.e. exact empty object - rather than being unsealed.
Some manual fixes, in particular to React Native code, which is used and can be synced to other repos (e.g. WWW).
With these changes, error diff in Xplat is down to ~1990 errors
Note that after I roll out `exact_empty_objects`, I'll codemod all the `{...null}` (the only way to get an exact empty object currently) back to `{}`
Changelog: [Internal]
Reviewed By: SamChou19815
Differential Revision: D36142838
fbshipit-source-id: 054caf370db230f42a4c5f5706c88979ef246537
27 lines
645 B
JavaScript
27 lines
645 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and 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
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
if (!global.performance) {
|
|
global.performance = ({...null}: {now?: () => number});
|
|
}
|
|
|
|
/**
|
|
* Returns a double, measured in milliseconds.
|
|
* https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
|
|
*/
|
|
if (typeof global.performance.now !== 'function') {
|
|
global.performance.now = function () {
|
|
const performanceNow = global.nativePerformanceNow || Date.now;
|
|
return performanceNow();
|
|
};
|
|
}
|