Last active
January 15, 2020 09:54
-
-
Save fabd/f17c422b5f48d3fdf3493c3f22c66572 to your computer and use it in GitHub Desktop.
console.log() helper function in TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// first attempt : but why? | |
const log = (...args: [any?, ...any[]]) => { console.log.apply(console, args) } | |
// better : use console.log() signature | |
const log = (msg?: any, ...params: any[]) => { console.log.apply(console, [msg, params]) } | |
// test | |
log('document is %o', document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment