improvements for non-experimental decorator types

オープン
#56,426 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript
領域
compilers

調査の方向性

ファイルもテストも指定されていません。まず既存の DecoratorContext 宣言と、それが対象とする decorator の型定義を見つけ、次に提案されている DecoratedValue のメンバーを現在の型システムと比較してください。合意された catch-all の値型が追加され、生成される JavaScript や既存の動作を変更していなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Awaiting More Feedback Domain: Decorators Suggestion
🔍 Search Terms

github typescript decorator value type

✅ Viability Checklist
⭐ Suggestion

This is a request to add a new utility type because TypeScript added one for decorator contexts but not for values

The DecoratorContext type is nice for catching all context types:

function decorator(value: unknown, context: DecoratorContext) { // optionally use a more specific type.
  // ...
}

But for value, there is not a good catch-all type.

📃 Motivating Example

If we have a context catch all type, why not also have a value catch all type, f.e. something like :

export type DecoratedValue = Constructor | Function | ClassAccessorDecoratorTarget<object, unknown> | undefined
💻 Use Cases
  1. What do you want to use this for? decorators whose code handles any value type
  2. What shortcomings exist with current approaches? we have to make the catchall for value ourselves, but we don't have to do that for context
  3. What workarounds are you using in the meantime? I make my own catchall (not that big a deal, but neither would making DecoratorContext myself be
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 15時間
マージ済み PR(30日)
106

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/TypeScript のほかの issue

microsoft/TypeScript の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。