fix: no-arg console.log is undefined (#22165)

This commit is contained in:
Shelley Vohr 2020-02-12 17:25:11 +00:00 committed by GitHub
parent d1fd237e61
commit 5e7c594691
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,8 +18,10 @@ require('@electron/internal/common/init')
if (process.platform === 'win32') { if (process.platform === 'win32') {
// Redirect node's console to use our own implementations, since node can not // Redirect node's console to use our own implementations, since node can not
// handle console output when running as GUI program. // handle console output when running as GUI program.
const consoleLog = (format: any, ...args: any[]) => { const consoleLog = (...args: any[]) => {
return process.log(util.format(format, ...args) + '\n') // @ts-ignore this typing is incorrect; 'format' is an optional parameter
// See https://nodejs.org/api/util.html#util_util_format_format_args
return process.log(util.format(...args) + '\n')
} }
const streamWrite: NodeJS.WritableStream['write'] = function (chunk: Buffer | string, encoding?: any, callback?: Function) { const streamWrite: NodeJS.WritableStream['write'] = function (chunk: Buffer | string, encoding?: any, callback?: Function) {
if (Buffer.isBuffer(chunk)) { if (Buffer.isBuffer(chunk)) {