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).

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

Comments

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.)

1 Comment

Thank you! I didn't realize it would be quite that easy!
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.