Fix ProxyGenerator type ordering for property type annotation forward references#2192
Merged
Merged
Conversation
…rom property type annotation
TypeScript's emitDecoratorMetadata emits __metadata("design:type", T) using the
declared property type annotation, not the argument passed to @field. So a property
like `@field(String) all!: FromEveryDefinition` creates a runtime reference to
FromEveryDefinition at class-definition time, causing a "Cannot access before
initialization" error when the class appears later in the same combined file.
Extend TopologicallySortBodies to also scan `!:` and `?:` property type annotations
(in addition to @field decorator arguments) when building the dependency graph for
topological ordering.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
einari
commented
May 4, 2026
Contributor
Author
einari
left a comment
There was a problem hiding this comment.
@copilot See the code review and implement as suggested; #2192 (review)
Agent-Logs-Url: https://github.com/Cratis/Arc/sessions/3fe0be17-314b-4aeb-9e7a-bae2435aab3d Co-authored-by: einari <134365+einari@users.noreply.github.com>
Contributor
Applied the suggested refactor in commit |
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
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.
Fixed
ReferenceError: Cannot access '...' before initializationin combined generated TypeScript files when a property uses@field(String)but its type annotation references another generated class (e.g.all!: FromEveryDefinition). TypeScript'semitDecoratorMetadataemits__metadata("design:type", T)based on the declared type annotation, not the@fieldargument — so the referenced class must appear earlier in the file.