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

Abierto
#65,020 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@NullVoxPopuli ya está trabajando en esto.

Desde el 29/10/2026.

  • #65022 de @NullVoxPopuli — abierto
  • #65029 de @timurzvural — cerrado sin fusionar

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
javascript, typescript

Línea de trabajo

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'].

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

[!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.

Lenguaje dominante
Go
Estrellas
112k
Forks
15.4k
Merge medio
2 d 21 h
PR fusionados (30 d)
126

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/TypeScript

Todos los issues de microsoft/TypeScript

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.