# Suggestion ## π Search Terms TypeQuery, `typeof this`, typeof members ## β Viability Checklist My suggestion meets these guidelines: * [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code * [x] This wouldn't change the runtime behavior of existing JavaScript code * [x] This could be implemented without emitting different JS based on the types of the expressions * [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.) * [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals). ## β Suggestion Add support for `typeof this.member`: ```ts class C { a: number; private getA(): typeof this.a {...} } ``` ## π Motivating Example 1. PR: #43898 2. VSCode supports this notation ## π» Use Cases ```ts class ComplexMember { readonly tree: { branch: number; bigBranch: { leaf: string; }; }; constructor() { // Clean constructor this.tree = this.getTree(); } private getTree(): typeof this.tree { return {...}; } } ```
Suggestion
π Search Terms
TypeQuery,
typeof this, typeof membersβ Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Add support for
typeof this.member:π Motivating Example
thisin typeQueryΒ #43898π» Use Cases