Repository navigation
fix: resolve TypeScript factory return annotations - #10
Merged
NianJiuZst merged 2 commits intoNov 2, 2026
Merged
Conversation
Implemented and validated by OpenAI Codex.
Exclude function-body types from return annotations and resolve imported return names in the TypeScript type namespace. Merge current main and advance engine rules to 10 so older indexes refresh. Validated: 204 tests passed, 1 existing ignored; format, strict Clippy, CLI/MCP smoke, incremental/full parity, and engine upgrade checks passed. Implemented and validated by OpenAI Codex on behalf of @hongtaihu.
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 #6.
make(): Akeeps its return annotation only in the display signature, soconst a = make(); a.run()missesA.runeven though the annotation identifies its receiver.Record TypeScript/TSX return annotations as resolver facts and propagate supported nominal types through named functions, variable-initialized arrows/function expressions, and methods. Resolve the type using enclosing declarations and explicit imports, including aliases and re-exports. Named and namespace imports use the type namespace when a type and runtime function share a name. The function body's declarations cannot shadow its return annotation. Unsupported annotations retain an explicit unknown receiver.
Integrated main
2c35e7a, preserving the satisfies and JS/TS resolution changes from PRs #5 and #12. Engine rules advance from 9 to 10 so existing indexes refresh; this PR makes no segment-format or vendored-kernel changes relative to main.Validation on Linux x86_64, Rust 1.99.1:
c795575and the function-body shadowing bug on the previous PR head249dd48; both pass after the fix.CGR_SYNC_SEQUENCES=6 CGR_SYNC_STEPS=100 cargo test --offline --locked --workspace: 204 passed, 1 existing ignored.Union/intersection types, generic substitution, arrays, async/generator wrappers, and block-level type shadowing remain outside the supported return rules. No new overall precision/recall, performance, or native macOS/Windows validation claim is made.
Implemented and validated by OpenAI Codex, on behalf of @hongtaihu.