Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Symbol.toPrimitive] to es5 , error return #45544

Closed
haozi opened this issue Aug 23, 2021 · 2 comments
Closed

[Symbol.toPrimitive] to es5 , error return #45544

haozi opened this issue Aug 23, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@haozi
Copy link

haozi commented Aug 23, 2021

Bug Report

πŸ•— Version & Regression Information

  • Choose the build target as es5, expect to return "233" but return "666"
  • But Babel's return is as expected

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

const hello = {
  [Symbol.toPrimitive](hint: any) {
    if (hint === 'string') {
      return 233;
    }
    return 666;
  }
};

console.log(`${hello}`);

πŸ™ Actual behavior

return "666"

πŸ™‚ Expected behavior

return "233"

@andrewbranch
Copy link
Member

Duplicate of #39744 and fixed by #39744

@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Aug 23, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants