Add support for setting emit flags and synthetic comments - #64500
Open
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 2 commits into
Open
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 2 commits into
Titian Cernicova-Dragomir (dragomirtitian) wants to merge 2 commits into
Conversation
Contributor
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Copilot started reviewing on behalf of
Titian Cernicova-Dragomir (dragomirtitian)
September 28, 2026 15:40
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Public API compatibility gaps, omitted enum members, and a nullable protocol entry that can panic must be addressed.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds emit flags and synthetic-comment support to the TypeScript API printer.
Changes:
- Introduces
EmitContextandEmitFlags. - Transfers emit metadata alongside encoded AST nodes.
- Adds synchronous and asynchronous API tests.
| File | Description |
|---|---|
tsc/internal/printer/printer.go |
Enables synthetic comments without a source file. |
tsc/internal/api/session.go |
Reconstructs emit metadata for printing. |
tsc/internal/api/proto.go |
Defines emit metadata protocol types. |
tsc/internal/api/enum_values_generated.go |
Adds generated emit flag values. |
tsc/internal/api/encoder/decoder.go |
Adds per-node decode callbacks. |
tools/scripts/tsc/generate-enums.ts |
Configures EmitFlags generation. |
packages/typescript/test/sync/api.test.ts |
Adds generated synchronous tests. |
packages/typescript/test/async/api.test.ts |
Tests comments and emit flags. |
packages/typescript/src/enums/emitFlags.ts |
Adds runtime enum output. |
packages/typescript/src/enums/emitFlags.enum.ts |
Adds typed enum output. |
packages/typescript/src/api/sync/api.ts |
Adds generated synchronous APIs. |
packages/typescript/src/api/proto.generated.ts |
Adds generated protocol declarations. |
packages/typescript/src/api/node/encoder.ts |
Reports encoded node indices. |
packages/typescript/src/api/async/api.ts |
Implements the public emit context API. |
Files not reviewed (1)
- tsc/internal/api/enum_values_generated.go: Generated file
| { name: "NodeBuilderFlags", goPrefix: "Flags", goFile: "tsc/internal/nodebuilder/types.go", outDir: "packages/typescript/src/enums" }, | ||
| { name: "CompletionItemKind", goPrefix: "CompletionItemKind", goFile: "tsc/internal/lsp/lsproto/lsp_generated.go", outDir: "packages/typescript/src/enums" }, | ||
| { name: "EmitOnly", goPrefix: "Emit", goFile: "tsc/internal/compiler/emitter.go", outDir: "packages/typescript/src/enums", excludeMembers: ["OnlyBuilderSignature"] }, | ||
| { name: "EmitFlags", goPrefix: "EF", goFile: "tsc/internal/printer/emitflags.go", outDir: "packages/typescript/src/enums" }, |
| preserveSourceNewlines?: boolean | undefined; | ||
| neverAsciiEscape?: boolean | undefined; | ||
| terminateUnterminatedLiterals?: boolean | undefined; | ||
| emitContext?: EmitContext; |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #64429