Skip to content

Detect exotic assignment patterns to JS prototypes #33454

Description

@a-ejs

Template added by by Matt Bierner (@mjbvz)

TS Versions: 3.7-20190911

Repo
For the JS:

function A() {}

A.prototype.foo = 1;

[A.prototype.bar] = [2],
{baz: A.prototype.baz} = {baz: 3};

const proto = A.prototype;
proto.prop = 4;

Expected
Intellisense for instances of A should show four properties

Actual
Only foo shown.

Original report below

Intellisense seems to only recognize straightforward prototype property definitions like Class.prototype.prop = value.

Assigning Class.prototype to a variable and extending that, or using destructuring syntax will not be recognized by it:

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Awaiting More FeedbackThis means we'd like to hear from more people who would be helped by this featureSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions