microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.17k stars 12.51k forks source link

[playground] Show transpiled output for JavaScript inputs #60330

Open nicolo-ribaudo opened 1 month ago

nicolo-ribaudo commented 1 month ago

Acknowledgement

Comment

Apologies if this is the wrong repository, I could not find one for the playground.

When setting the input language to "JavaScript", the playground does not show the transpiled code on the right. Instead, it shows the input code as-is.

You can test it by setting the target to ES2015 and writing 1 ** 2 in the input file: if the language is set to TypeScript you'll see Math.pow(1, 2) on the right (playground), while if the language is set to JavaScript you'll see 1 ** 2 (playground).

Is there a way to see the transpiled code?

MartinJohns commented 1 month ago

https://github.com/microsoft/TypeScript-Website

Supposedly it used to work? https://github.com/microsoft/TypeScript-Website/issues/169

Andarist commented 1 month ago

I'm almost sure this is the culprit of this difference in the behavior: https://github.com/microsoft/TypeScript-Website/blob/1f8e642574ce992bfd573a96b5e3de43d8ac044a/packages/sandbox/src/index.ts#L307-L319