microsoft / microsoft/TypeScript

JS Intellisense not detecting ES6 Symbol properties assigned after Initialization

Aperta
#43,317 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Domain: JavaScript
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

  • 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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con la riproduzione JavaScript nell’issue e analizza la gestione da parte del servizio di linguaggio TypeScript delle proprietà Symbol calcolate assegnate dopo l’inizializzazione dell’oggetto. Confronta IntelliSense per objLiteralsymKey e objAssignedsymKey, e considera completata l’issue quando entrambi forniscono le informazioni sulla funzione mostrate per il caso literal.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.