mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(lib.deno.shared_globals): Change the Console class to an interface (#7646)
Fixes #7494
This commit is contained in:
parent
6254bd41b7
commit
6a2ce3d91f
1 changed files with 23 additions and 63 deletions
86
cli/dts/lib.deno.shared_globals.d.ts
vendored
86
cli/dts/lib.deno.shared_globals.d.ts
vendored
|
@ -191,7 +191,6 @@ interface VoidFunction {
|
|||
*/
|
||||
declare function queueMicrotask(func: VoidFunction): void;
|
||||
|
||||
declare var console: Console;
|
||||
declare var crypto: Crypto;
|
||||
|
||||
/** Registers an event listener in the global scope, which will be called
|
||||
|
@ -242,70 +241,31 @@ type BufferSource = ArrayBufferView | ArrayBuffer;
|
|||
|
||||
declare const isConsoleInstance: unique symbol;
|
||||
|
||||
declare class Console {
|
||||
indentLevel: number;
|
||||
[isConsoleInstance]: boolean;
|
||||
/** Writes the arguments to stdout */
|
||||
log: (...args: unknown[]) => void;
|
||||
/** Writes the arguments to stdout */
|
||||
debug: (...args: unknown[]) => void;
|
||||
/** Writes the arguments to stdout */
|
||||
info: (...args: unknown[]) => void;
|
||||
/** Writes the properties of the supplied `obj` to stdout */
|
||||
dir: (
|
||||
obj: unknown,
|
||||
options?: Partial<{
|
||||
depth: number;
|
||||
indentLevel: number;
|
||||
}>,
|
||||
) => void;
|
||||
|
||||
/** Displays an interactive tree of the descendant elements of
|
||||
* the specified XML/HTML element. If it is not possible to display
|
||||
* as an element the JavaScript Object view is shown instead.
|
||||
* The output is presented as a hierarchical listing of expandable
|
||||
* nodes that let you see the contents of child nodes.
|
||||
*
|
||||
* Since we write to stdout, we can't display anything interactive
|
||||
* we just fall back to `console.dir`.
|
||||
*
|
||||
* > [Console.dirxml](https://developer.mozilla.org/en-US/docs/Web/API/Console/dirxml)
|
||||
* > by Mozilla Contributors is licensed under CC-BY-SA 2.5.
|
||||
*/
|
||||
dirxml: (
|
||||
obj: unknown,
|
||||
options?: Partial<{
|
||||
showHidden: boolean;
|
||||
depth: number;
|
||||
colors: boolean;
|
||||
indentLevel: number;
|
||||
}>,
|
||||
) => void;
|
||||
|
||||
/** Writes the arguments to stdout */
|
||||
warn: (...args: unknown[]) => void;
|
||||
/** Writes the arguments to stdout */
|
||||
error: (...args: unknown[]) => void;
|
||||
/** Writes an error message to stdout if the assertion is `false`. If the
|
||||
* assertion is `true`, nothing happens.
|
||||
*
|
||||
* ref: https://console.spec.whatwg.org/#assert
|
||||
*/
|
||||
assert: (condition?: boolean, ...args: unknown[]) => void;
|
||||
count: (label?: string) => void;
|
||||
countReset: (label?: string) => void;
|
||||
table: (data: unknown, properties?: string[] | undefined) => void;
|
||||
time: (label?: string) => void;
|
||||
timeLog: (label?: string, ...args: unknown[]) => void;
|
||||
timeEnd: (label?: string) => void;
|
||||
group: (...label: unknown[]) => void;
|
||||
groupCollapsed: (...label: unknown[]) => void;
|
||||
groupEnd: () => void;
|
||||
clear: () => void;
|
||||
trace: (...args: unknown[]) => void;
|
||||
static [Symbol.hasInstance](instance: Console): boolean;
|
||||
declare interface Console {
|
||||
assert(condition?: boolean, ...data: any[]): void;
|
||||
clear(): void;
|
||||
count(label?: string): void;
|
||||
countReset(label?: string): void;
|
||||
debug(...data: any[]): void;
|
||||
dir(item?: any, options?: any): void;
|
||||
dirxml(...data: any[]): void;
|
||||
error(...data: any[]): void;
|
||||
group(...data: any[]): void;
|
||||
groupCollapsed(...data: any[]): void;
|
||||
groupEnd(): void;
|
||||
info(...data: any[]): void;
|
||||
log(...data: any[]): void;
|
||||
table(tabularData?: any, properties?: string[]): void;
|
||||
time(label?: string): void;
|
||||
timeEnd(label?: string): void;
|
||||
timeLog(label?: string, ...data: any[]): void;
|
||||
timeStamp(label?: string): void;
|
||||
trace(...data: any[]): void;
|
||||
warn(...data: any[]): void;
|
||||
}
|
||||
|
||||
declare var console: Console;
|
||||
|
||||
declare interface Crypto {
|
||||
readonly subtle: null;
|
||||
getRandomValues<
|
||||
|
|
Loading…
Add table
Reference in a new issue