Skip to content

Native printer panics when printing JSDoc AST nodes #65057

Closed as not planned
Closed as not planned

Description

@el-j

🔎 Search Terms

emitJSDocNode, "not implemented", printer JSDoc, printNode JSDoc, JSDoc AST node panic

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about this. It reproduces on current main of the native (Go) compiler: Printer.emitJSDocNode is still a stub.

⏯ Playground Link

N/A. This is about the native Go printer and the TypeScript 7 JS API (api.printer.printNode), which the Playground does not exercise.

💻 Code

// Using the native API: create a JSDoc node with the factory and print it directly.
const doc = factory.createJSDocComment(
    "Adds two numbers.",
    factory.createNodeArray([
        factory.createJSDocParameterTag(
            factory.createJSDocTag(factory.createIdentifier("param"), undefined),
            factory.createIdentifier("a"),
            false,
        ),
    ]),
);
api.printer.printNode(doc); // panics

The same crash occurs for any JSDoc node kind that the printer dispatches to Printer.emitJSDocNode.

🙁 Actual behavior

The printer dispatches JSDoc node kinds to Printer.emitJSDocNode in tsc/internal/printer/printer.go, which is currently:

func (p *Printer) emitJSDocNode(node *ast.Node) {
	// !!!
	panic("not implemented")
}

so printing a JSDoc node panics.

🙂 Expected behavior

The printer should emit a formatted JSDoc comment, including its text and tags, like it does for other node kinds.

Additional information about the issue

I searched open and closed issues and PRs for this and found no other report or PR that implements JSDoc node emission. Open PR #64500 (synthetic comments and emit flags in the API) is related but does not implement emitJSDocNode.

I have a focused fix that I will link here as a PR. Sorry for the missing template in the first version of this issue, and thanks for pointing it out.

Activity

  1. RyanCavanaugh commented on Nov 9, 2026

    @RyanCavanaugh
    Member

    Please use a template

  2. el-j commented on Nov 10, 2026

    @el-j
    Author

    Thanks for the pointer, and sorry for skipping the template. I've re-filed this using the bug report template as #65429, and opened a new, narrower PR for it as #65430. Closing this one in favor of those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions