microsoft / microsoft/TypeScript

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

Offen
#36,514 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@rachelgshaffer arbeitet bereits daran.

Seit 11.6.2020.

Needs Investigation
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.3k
Ø Merge
2 T. 4 Std.
Gemergte PRs (30 T.)
132

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.