-
Notifications
You must be signed in to change notification settings - Fork 172
Description
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 tothrow new RangeError('Offset ' + offsetStr + ' is invalid for ' + dt + ' in ' + timeZoneString);, and the '+' operator invokesvalueOf.
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) ?