microsoft / microsoft/TypeScript
`typeof class`
オープン
@ahejlsberg がすでに取り組んでいます。
2020年11月18日 から。
Awaiting More Feedback
Needs Proposal
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
@ahejlsberg has had a few experiments to try to make it easier to describe the type of a class. Specifically:
-
avoiding the awkward static/instance pattern that users need to write on anonymous object types/interface types
var Thing: { new () => { instanceField: number; } staticField: string; } -
allowing users to describe types with class-specific characteristics (e.g.
abstract)
The idea is to allow typeof to be followed by a class expression.
var Thing: typeof class Thing {
static staticField: string;
instanceField: number;
constructor() {}
}
There are definitely some subtleties here. For example, handling loops and whether this syntax is allowed in JSDoc with a TypeScript-annotated class:
/** @type { typeof class C<T> { x: T } } */
// ^^^ ^^^
// TypeScript type parameters and annotations
// Are these allowed?
var Thing;
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。