This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
Reorganize AST to prevent duplicate fields - #4744
Merged
Merged
Conversation
Member
Author
|
TypeScript Bot (@typescript-bot) perf test this faster |
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents duplicate embedded AST bases, reducing parser memory usage while preserving TypeScript interface compatibility.
Changes:
- Restructures declaration and type-node inheritance to eliminate duplicate Go storage.
- Adds generator validation to reject duplicate base inheritance.
- Regenerates Go and native-preview TypeScript AST definitions.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
_scripts/ast.json |
Corrects AST inheritance relationships. |
_scripts/generate-go-ast.ts |
Validates base inheritance uniqueness. |
internal/ast/ast_generated.go |
Applies corrected Go struct layouts. |
internal/ast/ast.go |
Removes obsolete declaration accessors. |
_packages/native-preview/src/ast/ast.generated.ts |
Updates generated TypeScript interfaces. |
Files not reviewed (1)
- internal/ast/ast_generated.go: Generated file
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Gabriela Araujo Britto (gabritto)
approved these changes
Jul 27, 2026
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
Jake Bailey (jakebailey)
requested a review
from Gabriela Araujo Britto (gabritto)
July 27, 2026 16:17
Gabriela Araujo Britto (gabritto)
approved these changes
Jul 27, 2026
Jake Bailey (jakebailey)
enabled auto-merge
July 27, 2026 16:21
Jake Bailey (jakebailey)
added a commit
to jakebailey/TypeScript
that referenced
this pull request
Aug 13, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
While working on some stuff related to method wrapping, copilot randomly told me that we had accidentally duplicated a bunch of structs in our fun AST embedding layout, including
UnionTypeNode,IntersectionTypeNode,FunctionTypeNode,ConstructorTypeNode,FunctionExpression,MethodDeclaration, andGetAccessorDeclaration.Thankfully, the AST is now generated, so, fixing this is fairly easy and saves memory:
Also, reorder inheritance so that
Nodeis always first in the structs; this was not the case for many!