babel icon indicating copy to clipboard operation
babel copied to clipboard

Record & Tuple Plugin: transform typeof sites to reflect "record" or "tuple" instead of "object"

Open rricard opened this issue 3 years ago • 2 comments

💻

  • [x] Would you like to work on this feature?

What problem are you trying to solve?

The polyfilled Records and Tuples are still objects so the following assertions will fail:

const aRecord = #{};
const aTuple = #[];

assert(typeof aRecord === "record"); // currently the typeof is "object" if polyfilling
assert(typeof aTuple === "tuple"); // currently the typeof is "object" if polyfilling

Describe the solution you'd like

A rewrite of typeof calls should be done: this is similar to the rewrite that is done when polyfilling symbols.

Describe alternatives you've considered

N/A - this is the only way to respect the candidate spec

Documentation, Adoption, Migration Strategy

No response

rricard avatar Jun 15 '22 11:06 rricard

Hey @rricard! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

babel-bot avatar Jun 15 '22 11:06 babel-bot

We should make sure that this works both when compiling typeof symbols and when just compiling R&T.

nicolo-ribaudo avatar Jun 15 '22 11:06 nicolo-ribaudo