Skip to content

fix: preserve TypeScript initializer types through satisfies - #5

Merged
NianJiuZst merged 2 commits into
NianJiuZst:mainfrom
KennyMcSimpson:fix/typescript-satisfies-inference
Nov 2, 2026
Merged

NianJiuZst merged 2 commits into
NianJiuZst:mainfrom
KennyMcSimpson:fix/typescript-satisfies-inference

Conversation

@KennyMcSimpson

Copy link
Copy Markdown
Contributor

satisfies currently shares the as extraction rule and replaces the initializer's type with the constraint. For example, const service = new Service() satisfies Runner links service.run() to Runner::run and loses Service::extra, even though the concrete receiver remains Service.

Treat satisfies_expression as a transparent wrapper when collecting initializer evidence. Explicit annotations and inner as assertions keep their existing behavior. Factory call evidence is preserved without expanding the existing factory return-type inference. This follows TypeScript's documented semantics.

Bump the engine rules from 4 to 5 so existing indexes refresh their stored facts on sync. The snapshot format is unchanged.

Validation

  • New extraction and call-target regressions fail on 890912c and pass with the fix.
  • TS/TSX cases cover constructors, factory evidence, nested wrappers, as, explicit annotations, unknown operands and class fields.
  • A 42-file incremental regression checks concrete receiver changes, an inner as assertion and restoration against full rebuilds, without taking the full-rebuild fallback.
  • CGR_SYNC_SEQUENCES=6 CGR_SYNC_STEPS=100 cargo test --locked --workspace: 140 passed, 1 existing ignored.
  • CI package-format check and strict all-target workspace Clippy excluding the vendored kernel: passed.
  • CLI build and the existing CLI/MCP/hook smoke script: passed on Linux with Rust 1.99.1.

@NianJiuZst

Copy link
Copy Markdown
Owner

Please Allow edits from maintainers

@KennyMcSimpson

Copy link
Copy Markdown
Contributor Author

Sryyyy, I forgot to enable it when I submitted the PR. Now is ok

@NianJiuZst
NianJiuZst merged commit 2e83569 into NianJiuZst:main Nov 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants