tsickle should emit goog.reflect.objectProperty for property names passed to __rest tslib helper
mitchellwills opened this issue · 3 comments
mitchellwills commented
rest destructuring assignments are not safe for closure compiler because tsc/tsickle emits property names as quoted strings. It looks like it should be pretty simple to apply goog.reflect.objectProperty
here
Example Input:
const input = {x: 1, y: 2, z: 3};
const {x, ...rest} = input;
Current Emit:
const input = { x: 1, y: 2, z: 3 };
const { x } = input, rest = __rest(input, ["x"]);
Proposed Emit:
const input = { x: 1, y: 2, z: 3 };
const { x } = input, rest = __rest(input, [goog.reflect.objectProperty("x", input)]);
Related: #241
This probably applies to other emit too
evmar commented
To hook this, I think we'd need to postprocess the JS output to look for calls to __rest
(really tslib's rest).
jplaisted commented
Alternatively can tsickle just emit the same code? Why is it lowering the language level?
brad4d commented
Internal issue created http://b/171341422