You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function*test(){yieldfunction.sent;}test.prototype.foo=1vargen=test()if(!gen.foo){thrownewError("`gen.foo` not found")}
Configuration file name
No response
Configuration
No response
Current and expected behavior
Current behavior: throws an error with message `gen.foo` not found
Expected behavior: doesn't throw
Environment
Babel: v7.21.3
Whatever else is the case for the online REPL
Possible solution
Here's two possible solutions:
Add in an extra test.prototype = _test.prototype after the function (easiest, but doesn't tree-shake)
Keep test as a generator and instead of returning the iterator directly, returning yield* _test.apply(this, arguments) (tree shakes, but adds some extra overhead)
Additional context
No response
The text was updated successfully, but these errors were encountered:
Hey @dead-claudia! 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.
💻
How are you using Babel?
Programmatic API (
babel.transform
,babel.parse
)Input code
REPL: https://babeljs.io/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=GYVwdgxgLglg9mABAKigUwM5QBQEpEDeAUIogJ4xoA2AJoqJLAgHQZphQDcRAvkelmYAHAE5wo4skLTNgcOIgC8iAIxEAbgEMRiAObsliATlxEYwRNgCE-sLPn5ipKAAsxAd0Rg0ngKIixEWwAIgADW3s4UK9xejhwGmDTHiA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=&prettier=false&targets=&version=7.21.3&externalPlugins=%40babel%2Fplugin-proposal-function-sent%407.18.6&assumptions=%7B%7D
Configuration file name
No response
Configuration
No response
Current and expected behavior
Current behavior: throws an error with message
`gen.foo` not found
Expected behavior: doesn't throw
Environment
Possible solution
Here's two possible solutions:
test.prototype = _test.prototype
after the function (easiest, but doesn't tree-shake)test
as a generator and instead of returning the iterator directly, returningyield* _test.apply(this, arguments)
(tree shakes, but adds some extra overhead)Additional context
No response
The text was updated successfully, but these errors were encountered: