Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add console types #37048

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 26 additions & 40 deletions src/lib/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3723,40 +3723,6 @@ interface ConcatParams extends Algorithm {
publicInfo?: Uint8Array;
}

/** Provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
interface Console {
memory: any;
assert(condition?: boolean, message?: string, ...data: any[]): void;
clear(): void;
count(label?: string): void;
debug(message?: any, ...optionalParams: any[]): void;
dir(value?: any, ...optionalParams: any[]): void;
dirxml(value: any): void;
error(message?: any, ...optionalParams: any[]): void;
exception(message?: string, ...optionalParams: any[]): void;
group(groupTitle?: string, ...optionalParams: any[]): void;
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void;
groupEnd(): void;
info(message?: any, ...optionalParams: any[]): void;
log(message?: any, ...optionalParams: any[]): void;
markTimeline(label?: string): void;
profile(reportName?: string): void;
profileEnd(reportName?: string): void;
table(...tabularData: any[]): void;
time(label?: string): void;
timeEnd(label?: string): void;
timeStamp(label?: string): void;
timeline(label?: string): void;
timelineEnd(label?: string): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}

declare var Console: {
prototype: Console;
new(): Console;
};

interface ConstantSourceNode extends AudioScheduledSourceNode {
readonly offset: AudioParam;
addEventListener<K extends keyof AudioScheduledSourceNodeEventMap>(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
Expand Down Expand Up @@ -18590,7 +18556,7 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler
}

/** A window containing a DOM document; the document property points to the DOM document loaded in that window. */
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowConsole, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage {
interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandlers, WindowEventHandlers, WindowLocalStorage, WindowOrWorkerGlobalScope, WindowSessionStorage {
readonly applicationCache: ApplicationCache;
readonly clientInformation: Navigator;
readonly closed: boolean;
Expand Down Expand Up @@ -18721,10 +18687,6 @@ declare var Window: {
new(): Window;
};

interface WindowConsole {
readonly console: Console;
}

interface WindowEventHandlersEventMap {
"afterprint": Event;
"beforeprint": Event;
Expand Down Expand Up @@ -19125,6 +19087,31 @@ declare var webkitRTCPeerConnection: {

declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;

declare namespace console {
var memory: any;
function assert(condition?: boolean, ...data: any[]): void;
function clear(): void;
function count(label?: string): void;
function countReset(label?: string): void;
function debug(...data: any[]): void;
function dir(item?: any, options?: any): void;
function dirxml(...data: any[]): void;
function error(...data: any[]): void;
function exception(message?: string, ...optionalParams: any[]): void;
function group(...data: any[]): void;
function groupCollapsed(...data: any[]): void;
function groupEnd(): void;
function info(...data: any[]): void;
function log(...data: any[]): void;
function table(tabularData?: any, properties?: string[]): void;
function time(label?: string): void;
function timeEnd(label?: string): void;
function timeLog(label?: string, ...data: any[]): void;
function timeStamp(label?: string): void;
function trace(...data: any[]): void;
function warn(...data: any[]): void;
}

declare namespace WebAssembly {
interface CompileError {
}
Expand Down Expand Up @@ -19706,7 +19693,6 @@ declare function toString(): string;
declare function dispatchEvent(event: Event): boolean;
declare var sessionStorage: Storage;
declare var localStorage: Storage;
declare var console: Console;
/**
* Fires when the user aborts the download.
* @param ev The event.
Expand Down
66 changes: 26 additions & 40 deletions src/lib/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,40 +924,6 @@ interface ConcatParams extends Algorithm {
publicInfo?: Uint8Array;
}

/** Provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
interface Console {
memory: any;
assert(condition?: boolean, message?: string, ...data: any[]): void;
clear(): void;
count(label?: string): void;
debug(message?: any, ...optionalParams: any[]): void;
dir(value?: any, ...optionalParams: any[]): void;
dirxml(value: any): void;
error(message?: any, ...optionalParams: any[]): void;
exception(message?: string, ...optionalParams: any[]): void;
group(groupTitle?: string, ...optionalParams: any[]): void;
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void;
groupEnd(): void;
info(message?: any, ...optionalParams: any[]): void;
log(message?: any, ...optionalParams: any[]): void;
markTimeline(label?: string): void;
profile(reportName?: string): void;
profileEnd(reportName?: string): void;
table(...tabularData: any[]): void;
time(label?: string): void;
timeEnd(label?: string): void;
timeStamp(label?: string): void;
timeline(label?: string): void;
timelineEnd(label?: string): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}

declare var Console: {
prototype: Console;
new(): Console;
};

/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface CountQueuingStrategy extends QueuingStrategy {
highWaterMark: number;
Expand Down Expand Up @@ -5361,10 +5327,6 @@ declare var WindowClient: {
new(): WindowClient;
};

interface WindowConsole {
readonly console: Console;
}

interface WindowOrWorkerGlobalScope {
readonly caches: CacheStorage;
readonly crypto: Crypto;
Expand Down Expand Up @@ -5409,7 +5371,7 @@ interface WorkerGlobalScopeEventMap {
}

/** This Web Workers API interface is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by Window objects — in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop. */
interface WorkerGlobalScope extends EventTarget, WindowConsole, WindowOrWorkerGlobalScope, WorkerUtils {
interface WorkerGlobalScope extends EventTarget, WindowOrWorkerGlobalScope, WorkerUtils {
readonly caches: CacheStorage;
readonly isSecureContext: boolean;
readonly location: WorkerLocation;
Expand Down Expand Up @@ -5646,6 +5608,31 @@ declare var XMLHttpRequestUpload: {

declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;

declare namespace console {
var memory: any;
function assert(condition?: boolean, ...data: any[]): void;
function clear(): void;
function count(label?: string): void;
function countReset(label?: string): void;
function debug(...data: any[]): void;
function dir(item?: any, options?: any): void;
function dirxml(...data: any[]): void;
function error(...data: any[]): void;
function exception(message?: string, ...optionalParams: any[]): void;
function group(...data: any[]): void;
function groupCollapsed(...data: any[]): void;
function groupEnd(): void;
function info(...data: any[]): void;
function log(...data: any[]): void;
function table(tabularData?: any, properties?: string[]): void;
function time(label?: string): void;
function timeEnd(label?: string): void;
function timeLog(label?: string, ...data: any[]): void;
function timeStamp(label?: string): void;
function trace(...data: any[]): void;
function warn(...data: any[]): void;
}

declare namespace WebAssembly {
interface Global {
value: any;
Expand Down Expand Up @@ -5828,7 +5815,6 @@ declare var navigator: WorkerNavigator;
declare function importScripts(...urls: string[]): void;
declare function atob(encodedString: string): string;
declare function btoa(rawString: string): string;
declare var console: Console;
declare var caches: CacheStorage;
declare var crypto: Crypto;
declare var indexedDB: IDBFactory;
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of1.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ for (var v of ['a', 'b', 'c']) {
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))

console.log(v);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>v : Symbol(v, Decl(ES5For-of1.ts, 0, 8))
}
6 changes: 3 additions & 3 deletions tests/baselines/reference/ES5For-of1.types
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ for (var v of ['a', 'b', 'c']) {

console.log(v);
>console.log(v) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>v : string
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of22.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ for (var x of [1, 2, 3]) {
>_a : Symbol(_a, Decl(ES5For-of22.ts, 1, 7))

console.log(x);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>x : Symbol(x, Decl(ES5For-of22.ts, 0, 8))
}
6 changes: 3 additions & 3 deletions tests/baselines/reference/ES5For-of22.types
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ for (var x of [1, 2, 3]) {

console.log(x);
>console.log(x) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>x : number
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of23.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ for (var x of [1, 2, 3]) {
>_a : Symbol(_a, Decl(ES5For-of23.ts, 1, 7))

console.log(x);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>x : Symbol(x, Decl(ES5For-of23.ts, 0, 8))
}
6 changes: 3 additions & 3 deletions tests/baselines/reference/ES5For-of23.types
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ for (var x of [1, 2, 3]) {

console.log(x);
>console.log(x) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>x : number
}
4 changes: 2 additions & 2 deletions tests/baselines/reference/ES5For-of33.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ for (var v of ['a', 'b', 'c']) {
>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8))

console.log(v);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>v : Symbol(v, Decl(ES5For-of33.ts, 0, 8))
}
6 changes: 3 additions & 3 deletions tests/baselines/reference/ES5For-of33.types
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ for (var v of ['a', 'b', 'c']) {

console.log(v);
>console.log(v) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>v : string
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/ES5For-of37.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ for (const i of [0, 1, 2, 3, 4]) {
}
}
console.log(i);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10))

} catch (err) {
>err : Symbol(err, Decl(ES5For-of37.ts, 11, 13))

console.log('E %s %s', i, err);
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>i : Symbol(i, Decl(ES5For-of37.ts, 2, 10))
>err : Symbol(err, Decl(ES5For-of37.ts, 11, 13))
}
Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/reference/ES5For-of37.types
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ for (const i of [0, 1, 2, 3, 4]) {
}
console.log(i);
>console.log(i) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>i : number

} catch (err) {
>err : any

console.log('E %s %s', i, err);
>console.log('E %s %s', i, err) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>'E %s %s' : "E %s %s"
>i : number
>err : any
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/accessorsOverrideProperty2.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class Derived extends Base {
set x(value) { console.log(`x was set to ${value}`); }
>x : Symbol(Derived.x, Decl(accessorsOverrideProperty2.ts, 4, 28), Decl(accessorsOverrideProperty2.ts, 5, 23))
>value : Symbol(value, Decl(accessorsOverrideProperty2.ts, 6, 8))
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>value : Symbol(value, Decl(accessorsOverrideProperty2.ts, 6, 8))
}

Expand All @@ -27,9 +27,9 @@ const obj = new Derived(); // nothing printed
>Derived : Symbol(Derived, Decl(accessorsOverrideProperty2.ts, 2, 1))

console.log(obj.x); // 1
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>console.log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>console : Symbol(console, Decl(lib.dom.d.ts, --, --))
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --))
>log : Symbol(console.log, Decl(lib.dom.d.ts, --, --))
>obj.x : Symbol(Derived.x, Decl(accessorsOverrideProperty2.ts, 4, 28), Decl(accessorsOverrideProperty2.ts, 5, 23))
>obj : Symbol(obj, Decl(accessorsOverrideProperty2.ts, 9, 5))
>x : Symbol(Derived.x, Decl(accessorsOverrideProperty2.ts, 4, 28), Decl(accessorsOverrideProperty2.ts, 5, 23))
Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/reference/accessorsOverrideProperty2.types
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class Derived extends Base {
>x : number
>value : number
>console.log(`x was set to ${value}`) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>`x was set to ${value}` : string
>value : number
}
Expand All @@ -33,9 +33,9 @@ const obj = new Derived(); // nothing printed

console.log(obj.x); // 1
>console.log(obj.x) : void
>console.log : (message?: any, ...optionalParams: any[]) => void
>console : Console
>log : (message?: any, ...optionalParams: any[]) => void
>console.log : (...data: any[]) => void
>console : typeof console
>log : (...data: any[]) => void
>obj.x : number
>obj : Derived
>x : number
Expand Down
Loading