Add Flow type definition for the "debug" library

Reviewed By: rafeca

Differential Revision: D6706956

fbshipit-source-id: 6192beb439440ef36fd74645805922daf7318530
This commit is contained in:
Peter van der Zee 2018-01-12 02:50:44 -08:00 committed by Facebook Github Bot
parent 4cf85b278f
commit 4260847ad7
1 changed files with 43 additions and 0 deletions

43
flow-typed/debug.js.flow Normal file
View File

@ -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<mixed>) => 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<number>;
// 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<string>;
// declare export function save(namespaces: string): void;
// declare export var skips: Array<RegExp>;
// declare export function useColors(): boolean;
}