From 4260847ad773396315c2dcde12ea15bd4ee7e691 Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Fri, 12 Jan 2018 02:50:44 -0800 Subject: [PATCH] Add Flow type definition for the "debug" library Reviewed By: rafeca Differential Revision: D6706956 fbshipit-source-id: 6192beb439440ef36fd74645805922daf7318530 --- flow-typed/debug.js.flow | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 flow-typed/debug.js.flow diff --git a/flow-typed/debug.js.flow b/flow-typed/debug.js.flow new file mode 100644 index 00000000..539768cf --- /dev/null +++ b/flow-typed/debug.js.flow @@ -0,0 +1,43 @@ +/** + * 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. + * + * @flow + * @format + */ + +// https://github.com/visionmedia/debug +// https://www.npmjs.com/package/debug + +declare module 'debug' { + //declare export default (string) => (?mixed, ?mixed) => void + // declare export default (namespace: string) => void + // note: this is NOT a default export! There is no default property. + declare module.exports: (namespace: string) => (...Array) => void; + + // Unable to type the remaining API: + // "Found both `declare module.exports` and `declare export` in + // the same module. Modules can only have 1 since they are either + // an ES module xor they are a CommonJS module." + // And you can't call a union type so let's ignore the rest of the API. + // Note that we only use the main debug export anyways. + + // declare export function coerce(mixed): void; + // declare export var colors: Array; + // declare export function disable(namespace: string): void; + // declare export function enable(namespace: string): void; + // declare export function enabled(namespace: string): boolean; + // declare export function formatArgs(mixed): mixed; + // declare export var formatters: Array<(mixed) => void>; + // declare export function humanize(mixed): string; + // declare export function load(): string; + // declare export function log(mixed): void; + // declare export var names: Array; + // declare export function save(namespaces: string): void; + // declare export var skips: Array; + // declare export function useColors(): boolean; +}