Skip to content

Native printer panics when printing JSDoc AST nodes (emitJSDocNode not implemented) #65429

Open

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

var factory ast.NodeFactory
doc := factory.NewJSDoc(
	factory.NewNodeList([]*ast.Node{factory.NewJSDocText([]string{"This is a function description"})}),
	nil, /*tags*/
)
printer.NewPrinter(
	printer.PrinterOptions{NewLine: core.NewLineKindLF},
	printer.PrintHandlers{},
	nil,
).Emit(doc, nil) // panics: not implemented

The same panic is reachable from the JS API via api.printer.printNode(jsdocNode).

🙁 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.

This replaces #65057, which was closed because I did not use the issue template. Sorry about that, and thanks for pointing it out. A focused fix PR will be linked here.

Activity

  1. el-j commented on Nov 10, 2026

    @el-j
    Author

    Fix is up in #65430. Related context: #64429 / #64500 (synthetic comments and emit flags in the API) and #17146 (transforming and emitting JSDoc comments).

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