microsoft / microsoft/TypeScript

Function's attached JSDoc is not preserved when using OmitThisParameter

オープン
#54,783 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る

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

Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Bug Report

🔎 Search Terms

JSDoc, types with docs, preserve docs, OmitThisParameter, bind, inherit description

🕗 Version & Regression Information
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about "Something to do with this" and "Strong typing of Function members call/bind/apply"
⏯ Playground Link

Playground link with relevant code

💻 Code
/**
 * This description is lost
 * 
 * @param p As well as this decription
 */
function func(this: {}, p: string): void {}

const f = func as OmitThisParameter<typeof func>;
const g = func.bind({});
🙁 Actual behavior

Hovering over f (or g) shows the type but not the descriptions that were attached to func.

🙂 Expected behavior

f and g to inherit the descriptions of func.

Clarification

The problem mainly lies with OmitThisParameter as bind's declaration uses it.
I'm also not sure if this is considered a bug or a missing feature, so I apologize in advance if this is not the right way to report it.

Might be related to #50715

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

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

はじめの一歩

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

調査の方向性

提供されている Playground の再現から始め、OmitThisParameter がどのように宣言され、func に適用されているかを調べます。これには、それを使用している bind の宣言も含まれます。f と g にカーソルを合わせたときに func の説明と @param ドキュメントが保持され、関連する #50715 の議論に照らして既存の動作が確認されれば、Issue は完了です。

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

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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