mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Back out "Revert D120541798: [flow] Pre-align console typing with TS typing" (#58581)
Summary: X-link: https://github.com/react/metro/pull/1942 Pull Request resolved: https://github.com/react/react-native/pull/58581 Changelog: [internal] Reviewed By: panagosg7 Differential Revision: D120589546 fbshipit-source-id: 81272e57c75ce3c349be3592253fd6ef344b907f
This commit is contained in:
1 parent
a01ee31694
commit
c9b77eccc8
6 files changed
+40
-46
No files matched your search
@@ -13,8 +13,10 @@
|
||||
|
||||
import './setup';
|
||||
|
||||
const consoleError = console.error;
|
||||
const consoleWarn = console.warn;
|
||||
// $FlowFixMe[incompatible-type]
|
||||
const consoleError: (...data: ReadonlyArray<unknown>) => void = console.error;
|
||||
// $FlowFixMe[incompatible-type]
|
||||
const consoleWarn: (...data: ReadonlyArray<unknown>) => void = console.warn;
|
||||
|
||||
// $FlowFixMe[cannot-write]
|
||||
console.error = (...args) => {
|
||||
|
||||
@@ -29,46 +29,32 @@ declare interface ConsoleTask {
|
||||
run<T>(f: () => T): T;
|
||||
}
|
||||
|
||||
// $FlowExpectedError[libdef-override] Flow core definitions are incomplete.
|
||||
declare var console: {
|
||||
// Logging
|
||||
log(...data: ReadonlyArray<unknown>): void,
|
||||
trace(...data: ReadonlyArray<unknown>): void,
|
||||
debug(...data: ReadonlyArray<unknown>): void,
|
||||
info(...data: ReadonlyArray<unknown>): void,
|
||||
warn(...data: ReadonlyArray<unknown>): void,
|
||||
error(...data: ReadonlyArray<unknown>): void,
|
||||
interface Console {
|
||||
assert(condition?: boolean, ...data: ReadonlyArray<unknown>): void;
|
||||
clear(): void;
|
||||
count(label?: string): void;
|
||||
countReset(label?: string): void;
|
||||
debug(...data: ReadonlyArray<unknown>): void;
|
||||
dir(item?: unknown, options?: unknown): void;
|
||||
dirxml(...data: ReadonlyArray<unknown>): void;
|
||||
error(...data: ReadonlyArray<unknown>): void;
|
||||
group(...data: ReadonlyArray<unknown>): void;
|
||||
groupCollapsed(...data: ReadonlyArray<unknown>): void;
|
||||
groupEnd(): void;
|
||||
info(...data: ReadonlyArray<unknown>): void;
|
||||
log(...data: ReadonlyArray<unknown>): void;
|
||||
table(tabularData?: unknown, properties?: string[]): void;
|
||||
time(label?: string): void;
|
||||
timeEnd(label?: string): void;
|
||||
timeLog(label?: string, ...data: ReadonlyArray<unknown>): void;
|
||||
timeStamp(label?: string): void;
|
||||
trace(...data: ReadonlyArray<unknown>): void;
|
||||
warn(...data: ReadonlyArray<unknown>): void;
|
||||
}
|
||||
|
||||
// Grouping
|
||||
group(...data: ReadonlyArray<unknown>): void,
|
||||
groupCollapsed(...data: ReadonlyArray<unknown>): void,
|
||||
groupEnd(): void,
|
||||
|
||||
// Printing
|
||||
table(
|
||||
tabularData:
|
||||
| Readonly<{[key: string]: unknown, ...}>
|
||||
| ReadonlyArray<Readonly<{[key: string]: unknown, ...}>>
|
||||
| ReadonlyArray<ReadonlyArray<unknown>>,
|
||||
): void,
|
||||
dir(...data: ReadonlyArray<unknown>): void,
|
||||
dirxml(...data: ReadonlyArray<unknown>): void,
|
||||
clear(): void,
|
||||
|
||||
// Utilities
|
||||
assert(condition: unknown, ...data: ReadonlyArray<unknown>): void,
|
||||
|
||||
// Profiling
|
||||
profile(name?: string): void,
|
||||
profileEnd(name?: string): void,
|
||||
|
||||
// Counts
|
||||
count(label?: string): void,
|
||||
countReset(label?: string): void,
|
||||
|
||||
// Timing / tracing
|
||||
time(label?: string): void,
|
||||
timeEnd(label?: string): void,
|
||||
interface Console {
|
||||
profile(name?: string): void;
|
||||
profileEnd(name?: string): void;
|
||||
timeStamp(
|
||||
label?: string,
|
||||
start?: string | number,
|
||||
@@ -77,12 +63,12 @@ declare var console: {
|
||||
trackGroup?: string,
|
||||
color?: DevToolsColor,
|
||||
detail?: {[string]: unknown},
|
||||
): void,
|
||||
): void;
|
||||
createTask(label: string): ConsoleTask;
|
||||
}
|
||||
|
||||
// Stack tagging
|
||||
createTask(label: string): ConsoleTask,
|
||||
...
|
||||
};
|
||||
// $FlowExpectedError[libdef-override] Flow core definitions are incomplete.
|
||||
declare var console: Console;
|
||||
|
||||
declare class Navigator {
|
||||
product: 'ReactNative';
|
||||
|
||||
@@ -465,6 +465,7 @@ describe('Native Animated', () => {
|
||||
if (message.includes('The above error occurred in the')) {
|
||||
return;
|
||||
}
|
||||
// $FlowFixMe[incompatible-type]
|
||||
consoleError(...args);
|
||||
});
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ function PromiseTest(): React.Node {
|
||||
);
|
||||
}
|
||||
|
||||
// $FlowFixMe[incompatible-type]
|
||||
runTests().catch(console.error);
|
||||
}, []);
|
||||
|
||||
|
||||
+2
@@ -39,7 +39,9 @@ function CompatibilityNativeGestureHandling(): React.Node {
|
||||
.fill()
|
||||
.map((_, index) => {
|
||||
return (
|
||||
// $FlowFixMe[incompatible-type]
|
||||
<EventfulView
|
||||
// $FlowFixMe[incompatible-type]
|
||||
log={console.log}
|
||||
onDown
|
||||
onCancel
|
||||
|
||||
+2
@@ -37,6 +37,7 @@ function ItemFetcherBadExample(props: {
|
||||
});
|
||||
};
|
||||
|
||||
// $FlowFixMe[incompatible-type]
|
||||
fetchMoreItems(count).then((items: ItemDataType[]) => {
|
||||
onFetched(items);
|
||||
}, console.error);
|
||||
@@ -58,6 +59,7 @@ function ItemFetcherGoodExample(props: {
|
||||
});
|
||||
};
|
||||
|
||||
// $FlowFixMe[incompatible-type]
|
||||
fetchMoreItems(count).then((items: ItemDataType[]) => {
|
||||
onFetched(items);
|
||||
}, console.error);
|
||||
|
||||
Reference in new issue
Block a user