1

What TypeScript definition do I need in order for the TypeScript compiler to recognize Firebug's

window.console.debug

It recognizes

window.console.log

Without any issues. I can't find a Firebug-specific definitions file (and I'm not even sure what .js file I could generate a definition file from).

blaster
  • 8,876
  • 11
  • 48
  • 77

3 Answers3

5

The console.debug method has been deprecated (since Gecko 5) so your best bet is to switch to console.log - which is also cross-browser. Double win!

It is worth noting that console.debug was only an alias for console.log anyway, so you won't lose anything by switching to console.log.

https://developer.mozilla.org/en-US/docs/DOM/console

Fenton
  • 241,084
  • 71
  • 387
  • 401
3

You can create a interface for Console and reference the declaration.

// firebug.d.ts
interface Console {
  debug(message: any, ...optionalParams: any[]): void;
}

Console is the interface used by the core lib.d.ts.

(I don't know what specific parameters would be required for Firebug's console.debug, so you'll have to change the parameters I provided if they differ from console.log.)

Sean Hill
  • 14,978
  • 2
  • 50
  • 56
0

Don't assume console.log is always defined. It may not be in Internet Explorer unless you have debug tools open.

See 'console' is undefined error for Internet Explorer

And my question Redefine window.console with typescript

Community
  • 1
  • 1
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689