js-temporal/temporal-polyfill#21 (comment) exposed an issue we should look at. The problem @12wrigja found is that when string interpolation is polyfilled by TS (and perhaps by Babel too?) it's converted to +, which per https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.valueof will throw.
throw new RangeError(Offset ${offsetStr} is invalid for ${dt} in ${timeZoneString}); is transpiled by tsc to throw new RangeError('Offset ' + offsetStr + ' is invalid for ' + dt + ' in ' + timeZoneString);, and the '+' operator invokes valueOf.
This implies that code using Temporal instances in string interpolations will work fine in native ES6 but will throw when polyfilled into ES5. Is this OK? If not, are there any ways around it (e.g. by using @@toPrimitive) ?
js-temporal/temporal-polyfill#21 (comment) exposed an issue we should look at. The problem @12wrigja found is that when string interpolation is polyfilled by TS (and perhaps by Babel too?) it's converted to
+, which per https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.valueof will throw.This implies that code using Temporal instances in string interpolations will work fine in native ES6 but will throw when polyfilled into ES5. Is this OK? If not, are there any ways around it (e.g. by using
@@toPrimitive) ?