When you transpile code that contains a return statement that returns an object (such as {a: a, b: b}), the result is invalid JavaScript. When running it, you get: SyntaxError: Unexpected token ':' (referring to the second colon).
How to reproduce
- Transpile the following code:
var a = 1, b = 2;
function test() {
return { a: a, b: b };
};
console.log(test());
- Run the original code. The output is
{ a: 1, b: 2 }.
- Run the transpiled code. There is a syntax error.