Microsoft/TypeScript

Vanilla JS: Mixins break inherited type hints

Open

#56,663 建立於 2023年12月1日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
Domain: LS: Quick InfoExperience EnhancementHelp WantedSuggestion

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

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;

	}

}

貢獻者指南