Skip to content

generator function es5 polyfill unexpected behavior in ForInStatement and deleteStatement #49808

New issue

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

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

Already on GitHub? Sign in to your account

Closed
konicyQWQ opened this issue Jul 6, 2022 · 0 comments Β· Fixed by #51295
Closed
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@konicyQWQ
Copy link

Bug Report

πŸ”Ž Search Terms

generator function polyfill

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried.

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

function* gen() {
    var count = 0;
    var obj = { foo: 1, bar: 2 };
    for (var key in obj) {
        console.log(obj.hasOwnProperty(key))
        yield [key, obj[key]];
        delete obj.bar;
        count += 1;
    }
    return count;
}

let itr = gen();
itr.next();
itr.next();

πŸ™ Actual behavior

true
false

πŸ™‚ Expected behavior

true
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jul 6, 2022
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.9.0 milestone Jul 6, 2022
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants