From e2eed3984e76332239b984648dcf9fa0e4ccdfe8 Mon Sep 17 00:00:00 2001 From: Vitali Zaidman Date: Thu, 13 Mar 2025 04:10:38 -0700 Subject: [PATCH] update the npm package "debug" flow types to v4.4.x (#49980) Summary: X-link: https://github.com/facebook/metro/pull/1462 Pull Request resolved: https://github.com/facebook/react-native/pull/49980 Changelog: [General][Internal] update the npm package "debug" flow types to v4.4.x Reviewed By: robhogan Differential Revision: D70976838 fbshipit-source-id: 7ca7daf5e7677721b0464c66dd482a40cea3ae61 --- flow-typed/npm/debug_v2.x.x.js | 28 ------------------ flow-typed/npm/debug_v4.4.x.js | 54 ++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 28 deletions(-) delete mode 100644 flow-typed/npm/debug_v2.x.x.js create mode 100644 flow-typed/npm/debug_v4.4.x.js diff --git a/flow-typed/npm/debug_v2.x.x.js b/flow-typed/npm/debug_v2.x.x.js deleted file mode 100644 index 675c2fe6fce..00000000000 --- a/flow-typed/npm/debug_v2.x.x.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 - * @format - */ - -// https://github.com/visionmedia/debug -// https://www.npmjs.com/package/debug - -interface DebugFN { - (...args: Array): void; - enable(match: string): void; - disable(): void; - enabled: () => boolean; -} - -declare module 'debug' { - declare module.exports: { - (namespace: string): DebugFN, - enable(match: string): void, - disable(): void, - enabled: () => boolean, - }; -} diff --git a/flow-typed/npm/debug_v4.4.x.js b/flow-typed/npm/debug_v4.4.x.js new file mode 100644 index 00000000000..fea4ad05c4d --- /dev/null +++ b/flow-typed/npm/debug_v4.4.x.js @@ -0,0 +1,54 @@ +/** + * 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 + * @format + */ + +// stubbed from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/451dc8fc19383bc12af59522020e571957f1684e/types/debug/index.d.ts + +declare module 'debug' { + declare interface Formatters { + [formatter: string]: (v: mixed) => string; + } + + declare type Debugger = {| + (format: mixed, ...args: Array): void, + color: string, + diff: number, + enabled: boolean, + log: (format: mixed, ...args: Array) => mixed, + namespace: string, + destroy: () => boolean, + extend: (namespace: string, delimiter?: string) => Debugger, + |}; + + declare type Debug = {| + (namespace: string): Debugger, + coerce: (val: mixed) => mixed, + disable: () => string, + enable: (namespaces: string) => void, + enabled: (namespaces: string) => boolean, + formatArgs: (args: Array) => void, + log: (format: mixed, ...args: Array) => mixed, + selectColor: (namespace: string) => string | number, + // this should be of type require('ms') but it doesn't play nicely with eslint + // unless we add ms to dependencies, which we don't want to do + humanize: $FlowFixMe, + names: RegExp[], + skips: RegExp[], + formatters: Formatters, + inspectOpts?: { + hideDate?: boolean | number | null, + colors?: boolean | number | null, + depth?: boolean | number | null, + showHidden?: boolean | number | null, + ... + }, + |}; + + declare module.exports: Debug; +}