Skip to content

This-type fix for prototypes only works at top-level #27095

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
sandersn opened this issue Sep 14, 2018 · 1 comment · Fixed by #27096
Closed

This-type fix for prototypes only works at top-level #27095

sandersn opened this issue Sep 14, 2018 · 1 comment · Fixed by #27096
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@sandersn
Copy link
Member

#26925 only works at top-level:

(function () {
    function Brunch(children) {
        this.parent = null;
    }

    Brunch.prototype = {
        removeInner: function(at, n) {
            this.collapse();
        },

        collapse: function() {
        },
    };
});

Expected behavior:
No error on this.collapse and this: Brunch & { removeInner, collapse }

Actual behavior:
Error on this.collapse and this: Brunch.

@sandersn
Copy link
Member Author

The better typing in #26295 exposes a bug in the binder: the node that is used to look for the containing class of prototype assignments was incorrect.

@sandersn sandersn added Bug A bug in TypeScript Fixed A PR has been merged for this issue Salsa labels Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant