Microsoft/TypeScript

Vanilla JS: Mixins break inherited type hints

Open

#56,663 opened on 2023年12月1日

GitHub で見る
 (0 comments) (0 reactions) (0 assignees)TypeScript (6,726 forks)batch import
Domain: LS: Quick InfoExperience EnhancementHelp WantedSuggestion

Repository metrics

Stars
 (48,455 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 9 merged PRs)

説明

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;

	}

}

コントリビューターガイド