Skip to content
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
29 changes: 17 additions & 12 deletions packages/playground/src/sidebar/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,18 +234,23 @@ function rewireLoggingToElement(
}

function produceOutput(args: any[]) {
let result: string = args.reduce((output: any, arg: any, index) => {
const textRep = objectToText(arg)
const showComma = index !== args.length - 1
const comma = showComma ? "<span class='comma'>, </span>" : ""
return output + textRep + comma + " "
}, "")

Object.keys(replacers).forEach(k => {
result = result.replace(new RegExp((replacers as any)[k], "g"), k)
})

return result
try {
let result: string = args.reduce((output: any, arg: any, index) => {
const textRep = objectToText(arg)
const showComma = index !== args.length - 1
const comma = showComma ? "<span class='comma'>, </span>" : ""
return output + textRep + comma + " "
}, "")

Object.keys(replacers).forEach(k => {
result = result.replace(new RegExp((replacers as any)[k], "g"), k)
})

return result
} catch (error) {
console.warn(i("play_run_log_fail"), error)
return i("play_run_log_fail")
}
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/typescriptlang-org/src/copy/en/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const playCopy = {
play_run_js: "Executed JavaScript",
play_run_ts: "Executed transpiled TypeScript",
play_run_js_fail: "Executed JavaScript Failed:",
play_run_log_fail: "Failed to serialize log",
play_default_code_sample: `// Welcome to the TypeScript Playground, this is a website
// which gives you a chance to write, share and learn TypeScript.

Expand Down