microsoft / microsoft/TypeScript

VSCode JSDoc doesn't recognize members that are classes from default imported object.

Aperta
#36,514 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@rachelgshaffer ci sta già lavorando.

Dal 11/6/2020.

Needs Investigation
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

VSCode Version: 1.41.1

Search Terms:
jsdoc export import class object type

Code

a.js

export default class A {
	constructor() {
		this.m = 2;
	}
}

b.js

export default class B {
	constructor() {
		this.n = 4;
	}
}

lib.js

import A from './a';
import B from './b';

const Lib = {
	A,
	B
};

export default Lib;

app.js

import Lib from './lib';

/**
 * @param {Lib.A} a
 * @param {Lib.B} b
 */
function foo(a, b) {
}

function bar() {
	const a = new Lib.A();
	foo(new Lib.A(), new Lib.B());
}

Expected behavior:
When I hover over the Lib in the @param jsdoc of app.js foo function, the tooltip should read something similar to what happens in the bar function:

(alias) const Lib: {
    A: typeof A;
    B: typeof B;
}
import Lib

And when I hover over the Lib.A in the same area, the tooltip should read something similar to what happens in the bar function:

(property) A: new () => A

Actual behavior:
When I hover over the Lib or Lib.A in the @param jsdoc of app.js foo function, the types are any, not being recognized as a particular type.

The hovering over types in actual javascript within the bar function works great.

Related Issues:

I searched, but I'm not seeing any similar issue. Maybe I'm missing something obvious?

Notes
I don't believe I saw this behavior in earlier versions of VSCode (maybe even October or September 2019 releases). My code base hasn't changed, but the editor has been upgraded.

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.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.