Title: Type parameter escapes its constraint in a recursive call resolution · Issue #64529 · microsoft/TypeScript · GitHub
Open Graph Title: Type parameter escapes its constraint in a recursive call resolution · Issue #64529 · microsoft/TypeScript
X Title: Type parameter escapes its constraint in a recursive call resolution · Issue #64529 · microsoft/TypeScript
Description: 🔎 Search Terms recursive, constraint, satisfies, return type inference, 64311 🕗 Version & Regression Information Introduced by #64311 (7.1.0-dev.20260918.1), still present in 7.1.0-dev.20260929.1. Before #64311 the declaration was a circ...
Open Graph Description: 🔎 Search Terms recursive, constraint, satisfies, return type inference, 64311 🕗 Version & Regression Information Introduced by #64311 (7.1.0-dev.20260918.1), still present in 7.1.0-dev.20260929.1. ...
X Description: 🔎 Search Terms recursive, constraint, satisfies, return type inference, 64311 🕗 Version & Regression Information Introduced by #64311 (7.1.0-dev.20260918.1), still present in 7.1.0-dev.20260929...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/64529
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type parameter escapes its constraint in a recursive call resolution","articleBody":"### 🔎 Search Terms\n\nrecursive, constraint, satisfies, return type inference, 64311\n\n### 🕗 Version & Regression Information\n\n- Introduced by #64311 (`7.1.0-dev.20260918.1`), still present in `7.1.0-dev.20260929.1`. Before #64311 the declaration was a circularity error.\n\n### ⏯ Playground Link\n\n_No response_\n\n### 💻 Code\n\n```ts\ninterface Schema\u003cO> { readonly out: O }\ntype Shape = Record\u003cstring, Schema\u003cany>>;\ntype Lookup = { x: 1; dflt: 2 };\ndeclare function object\u003cS extends Shape, P extends keyof Lookup>(shape: S): Schema\u003c{ [K in keyof S]: S[K][\"out\"] }> & { p: P; f: (x: P) => void };\ndeclare const str: Schema\u003cstring>;\n\nconst u = object({ name: str }) satisfies { p: number | \"x\" };\nu.f(42); // error, P is \"x\"\n\nconst t = object({ name: str, get rec() { return object({ inner: t }); } }) satisfies { p: number | \"x\" };\nt.f(42); // no error\nconst tp: \"x\" = t.p; // error: Type 'number | \"x\"' is not assignable to type '\"x\"'\n```\n\n### 🙁 Actual behavior\n\n`P` on `t` is `number | \"x\"`, outside `keyof Lookup`, with no diagnostic. `P` only has a return-type inference from `satisfies`. The outer resolution filters it by the constraint, the re-entrant one doesn't, and `typeof t` ends up with the re-entrant result. With two mutually recursive consts only the one that resolves first gets the leaked type, so swapping the declaration order moves the error. Wes raised this in review: https://github.com/microsoft/TypeScript/pull/64311#pullrequestreview-5239678270\n\n### 🙂 Expected behavior\n\n`P` is `\"x\"` on `t` as it is on `u`, and `t.f(42)` is an error.\n\n### Additional information about the issue\n\n_No response_\n","author":{"url":"https://github.com/colinhacks","@type":"Person","name":"colinhacks"},"datePublished":"2026-09-29T15:05:52Z","url":"https://github.com/microsoft/TypeScript/issues/64529"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:91b9aa15-3c56-aa9f-ada1-348593bf9441 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B724:1D8AA1:F9736E:1494C4B:6B0101AF |
| html-safe-nonce | 913572a298d76e42e1f771664ec02a6feccbe57ab808fed4f9875f2b78ff5a82 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzI0OjFEOEFBMTpGOTczNkU6MTQ5NEM0Qjo2QjAxMDFBRiIsInZpc2l0b3JfaWQiOiIzNDUwOTMwNTg5NzU3MTQ1NTE5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 74814c7db2a273b93807c6b02799f10e622408d6b2110dec1d66a2b994584f1a |
| hovercard-subject-tag | issue:5632640763 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/64529/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bec283746cc3141e3a2cbfbe109083793882fca4f0a10560c06b810b0beafe5f/microsoft/TypeScript/issues/64529 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bec283746cc3141e3a2cbfbe109083793882fca4f0a10560c06b810b0beafe5f/microsoft/TypeScript/issues/64529 |
| og:image:alt | 🔎 Search Terms recursive, constraint, satisfies, return type inference, 64311 🕗 Version & Regression Information Introduced by #64311 (7.1.0-dev.20260918.1), still present in 7.1.0-dev.20260929.1. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | colinhacks |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width