JSDoc: a nested @property with a type that does not parse drops every nested @property after it

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

メンテナーはふだん 1 日以内に返信

@NullVoxPopuli がすでに取り組んでいます。

2026年10月29日 から。

  • #65022 @NullVoxPopuli による — オープン
  • #65029 @timurzvural による — マージされずにクローズ

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, typescript

調査の方向性

Start by tracing how the JSDoc parser handles nested @property tags in the supplied index.js example, then compare its recovery with the flat-property case described in the issue. Use the supplied tsconfig.json and check.ts repro to confirm that only Args.onSave is omitted while Args.onCancel remains in keyof Sig['Args'].

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

説明

[!NOTE]
Investigated with Claude (via Claude Code); corrections welcome.

🔎 Search Terms

jsdoc, typedef, nested property, function(, TS1005

🕗 Version & Regression Information
  • Works: 6.0.3
  • Broken: 7.0.2, 7.1.0-beta, 7.1.0-dev.20261029.1

CHANGES.md says Closure-style function(...) types are no longer supported, so the TS1005 is expected. This issue is about what happens to the other @property tags in the same typedef.

💻 Code

tsconfig.json

{
  "compilerOptions": { "allowJs": true, "checkJs": true, "noEmit": true, "strict": true },
  "include": ["index.js", "check.ts"]
}

index.js

/**
 * @typedef Sig
 * @property {object} Args
 * @property {string} Args.name
 * @property {function(string)=} Args.onSave
 * @property {((v: string) => void)=} Args.onCancel
 */

export {};

check.ts

import type { Sig } from './index.js';

export const a: Array<keyof Sig['Args']> = ['name'];
export const b: Array<keyof Sig['Args']> = ['onSave'];
export const c: Array<keyof Sig['Args']> = ['onCancel'];
🙁 Actual behavior
check.ts(4,45): error TS2322: Type '"onSave"' is not assignable to type '"name"'.
check.ts(5,45): error TS2322: Type '"onCancel"' is not assignable to type '"name"'.
index.js(5,23): error TS1005: '}' expected.

onCancel is also missing, but its type has valid syntax. Every nested property after the one that does not parse is gone.

With flat properties (@property {function(string)=} onSave), only onSave is missing and onCancel is kept. So the problem is in recovery for nested Args.* properties.

🙂 Expected behavior

Only Args.onSave is affected. Args.onCancel is kept, as it is with flat properties.

Additional information about the issue

In real code the only error at the use site is that the property does not exist. For example, a component invocation reports 'onCancel' does not exist in type ..., in a different file from the TS1005. With many typedefs in a codebase, it is hard to connect the two.

主要言語
Go
スター
112k
フォーク
15.4k
平均マージ
2日 21時間
マージ済み PR(30日)
126

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

microsoft/TypeScript のほかの issue

microsoft/TypeScript の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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