microsoft / microsoft/TypeScript

JS Intellisense not detecting ES6 Symbol properties assigned after Initialization

オープン
#43,317 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Domain: JavaScript
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

  • VS Code Version: 1.54.3
  • OS Version: Windows 10 Pro, version 20H2, build 19042.804

Steps to Reproduce:

  1. Initialize a Symbol
  2. Initialize an empty object literal
  3. Assign the object a function, using the symbol as its property

The following code also demonstrates some of the steps to reproduce:

const symKey = Symbol();


/** @namespace */
var objLiteral = {
    literalPublicFn1() {},

    /**
     * You found the secret fn!
     */
    [symKey]() {},
};


/** @namespace */
var objAssigned = {};

/** @memberof objAssigned */
objAssigned.laterPublicFn1 = function() {};

/** 
 * You found the secret fn!
 * @memberof objAssigned 
 * */
objAssigned[symKey] = function () {}

For both objects, the string properties are picked up by Intellisense and autocompleted as expected. However, Intellisense only provides function info for the symbol on the objLiteral object, where the symbol property was declared as part of the literal. For the objAssigned object, where the symbol property was assigned after initialization, no function info is provided.

In other words, intellisense works when calling objLiteral[symKey]() but not when calling objAssigned[symKey]()

Does this issue occur when all extensions are disabled?: Yes

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue 内の JavaScript 再現から始め、オブジェクトの初期化後に割り当てられた computed Symbol プロパティを TypeScript language-service がどのように処理するかを調査します。objLiteralsymKey と objAssignedsymKey の IntelliSense を比較し、両方でリテラルの場合に表示される関数情報が提供されることを確認できたら、issue は完了とします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript, vscode
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。