Microsoft/TypeScript

Vanilla JS: Mixins break inherited type hints

Open

#56.663 geöffnet am 1. Dez. 2023

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
Domain: LS: Quick InfoExperience EnhancementHelp WantedSuggestion

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

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

  • VS Code Version: 1.84.2
  • OS Version: Windows 10

The issue is quite simple, as shown below, mixins break inherited type hints. exampleMethod() below should have hint references for this.myStr and this.propIsHinted but does not.

Apologies if this belongs somewhere else like the typescript repo, it's vanilla JS but it's probably related to typescript/JSDoc functionality.

function NumberMixin( Base ) {

	return class NumberMixin extends Base {

		/** @type {number} */
		myNum;

	};

}

function StringMixin( Base ) {

	return class StringMixin extends Base {

		/** @type {string} */
		myStr;

	};

}

class MyBase {

	/** @type {boolean} */
	propIsHinted;

}

class SuperClass extends NumberMixin(StringMixin(MyBase)) {

	exampleMethod() {

		// Hinted
		this.myNum;

		// Not hinted
		this.myStr;

		// Not hinted
		this.propIsHinted;

	}

}

Contributor Guide