JSDocTypeLiteral.jsdocPropertyTags returns only the first tag

Offen
#64,899 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@icecold009 arbeitet bereits daran.

Seit 21.10.2026.

  • #64913 von @icecold009 — offen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
typescript
Bereich
api, tooling

Rechercherichtung

Start with the JSDocPropertyTags definition in tools/scripts/tsc/ast.json and the getter generation in tools/scripts/tsc/generate-encoder.ts; the issue links a related report, #64864. Trace how raw child arrays are encoded and how generated getters handle list properties. Done when jsdocPropertyTags exposes all three tags as a node list while child traversal remains correct; an open pull request is already linked.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Bug
🔎 Search Terms

jsdocPropertyTags, JSDocTypeLiteral, JSDocPropertyTag, typedef property, native API, sync API, NodeList

🕗 Version & Regression Information

This is the behavior in every v7 version I tried: 7.0.2 (typescript/unstable/*), 7.1.0-beta, and 7.1.0-dev.20261021.1. In 6.0, jsDocPropertyTags holds all the tags.

⏯ Playground Link

No response

💻 Code
import {API} from 'typescript/sync';
import {createFileSystem} from 'typescript/fs';

const api = new API({cwd: '/'});
const snapshot = api.createSnapshot({
    openProjects: ['/tsconfig.json'],
    fileSystem: createFileSystem([
        ['/tsconfig.json', JSON.stringify({files: ['/input.js'], compilerOptions: {allowJs: true, noLib: true}})],
        ['/input.js', `/**
 * @typedef {Object} Events
 * @property {string} a
 * @property {string} b
 * @property {string} c
 */
export const x = 1;`],
    ]),
});
const sourceFile = snapshot.getProjects()[0].program.getSourceFile('/input.js');
const literal = sourceFile.statements[0].jsDoc[0].tags[0].typeExpression;

console.log(literal.jsdocPropertyTags.length, literal.jsdocPropertyTags.name?.text);

const walked = [];
literal.forEachChild(node => { walked.push(node.name.text); });
console.log(walked);

api.close();
🙁 Actual behavior
undefined a
[ 'a', 'b', 'c' ]

jsdocPropertyTags is the first JSDocPropertyTag node, not a list. forEachChild still visits all three tags.

🙂 Expected behavior

jsdocPropertyTags is a node list containing all three tags, as jsDocPropertyTags is in 6.0.

Additional information about the issue

JSDocPropertyTags is a raw []*Node in tools/scripts/tsc/ast.json ("list": "raw"), so the encoder writes the tags as direct children of the node, with no NodeList entry. generateTSNodeGenerated in tools/scripts/tsc/generate-encoder.ts only treats nodeList and modifierList as lists, so this property gets a single-node getter that returns child 0.

Possibly related: #64864.

Vorherrschende Sprache
Go
Sterne
112k
Forks
15.4k
Ø Merge
3 T. 6 Std.
Gemergte PRs (30 T.)
136

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/TypeScript

Alle Issues in microsoft/TypeScript

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.