microsoft / microsoft/TypeScript

Recognize properties introduced by jQuery extend

Open
#31,314 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

The old VS JS language service used to make runtime types available at design-time, allowing it to support jQuery's extend function for adding properties dynamically. The new one uses static types and so does not offer these symbols during completion, navigate-to, etc. We've had some customer inquiries about the possibility of supporting this functionality in the TS language service.

https://developercommunity.visualstudio.com/content/problem/529989/aspnet-在html-文件-js-智能提示失效.html
https://developercommunity.visualstudio.com/content/problem/560277/javascript-go-to-members-doesnt-work-with-property.html

The latter provided this example:

(function ($) {

    mynamespace.myClass = Class.extend({
      init: function (options) {
        // unless you specifically type this.testProperty = "abc" in JS, the 'Go to Members' will not find the below property even though it's explicitely defined.
      },
       __properties: {

       'testProperty': {
                /// <summary>
                /// Gets or sets the test property
                /// </summary>
                /// <value type="String"></value>

                get: function () {
                    return this._testProperty;
                },

                set: function (value) {
                    this._testProperty = value;
                }
            }
       }
   });

})(jQuery);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the two linked Developer Community reports and the jQuery/Class.extend example. No source files or tests are named, so first identify the TypeScript language-service entry points for completion and navigate-to, then define what recognition of dynamically introduced properties should cover and how it can be tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.