Title: TS2322 missed with 3+ checkers: `keyof` depends on checker assignment when an interface's index signature uses its own `keyof` · Issue #65543 · microsoft/TypeScript · GitHub
Open Graph Title: TS2322 missed with 3+ checkers: `keyof` depends on checker assignment when an interface's index signature uses its own `keyof` · Issue #65543 · microsoft/TypeScript
X Title: TS2322 missed with 3+ checkers: `keyof` depends on checker assignment when an interface's index signature uses its own `keyof` · Issue #65543 · microsoft/TypeScript
Description: 🔎 Search Terms keyof index signature, index signature refers to its own keyof, self-referential index signature, circular keyof, Props[keyof Props], --checkers, --singleThreaded, checker assignment, check order, order dependent, TS2322, ...
Open Graph Description: 🔎 Search Terms keyof index signature, index signature refers to its own keyof, self-referential index signature, circular keyof, Props[keyof Props], --checkers, --singleThreaded, checker assignment...
X Description: 🔎 Search Terms keyof index signature, index signature refers to its own keyof, self-referential index signature, circular keyof, Props[keyof Props], --checkers, --singleThreaded, checker assignment...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/65543
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TS2322 missed with 3+ checkers: `keyof` depends on checker assignment when an interface's index signature uses its own `keyof`","articleBody":"### 🔎 Search Terms\n\nkeyof index signature, index signature refers to its own keyof, self-referential index signature, circular keyof, `Props[keyof Props]`, `--checkers`, `--singleThreaded`, checker assignment, check order, order dependent, TS2322, checker count dependent\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every TS 7 version I tried, back to 7.0.2. 6.0.3 has one checker and reports the error.\n\n\n### ⏯ Playground Link\n\nhttps://tsgo.sxzz.dev/#eNptk0+P2jAQxb/KyD0AUjb8WYpKVlXVVS+ttGpVkHogHJxkQtxN7Mh22EUs371jB1BS9uTgef69N2NzZDmLNhuWKmmaCnVoDQvYeAx/hC0gZmmB6TNqE7MIpgFYs1OgsVbaGhi+OM3dnRFyV+K60MgzzMAqNYpiSQyADna4DKbzUQSotdKwXs3uZ7MI1ocaYTAZgDAglQVujNhJnpRIHLC++owHlcMvrWozCD34nXBzGNoCIcOcN6UdBSDsNahUratpT3d4FLBCA6pxzkTkMYM3WhNaRQ62oFi5KHFAytYMChLy0vV68LR2P4Pa8ajPALjMHM1YTYMhnGyqhA4SjzLRcTmwIU0yhUU4Ce+vKSm+B/qoIawQoRKpVkblduzmtEq1qO2HxXy5/ESdiMqda2d0PLdzglyrihoIxz5PzB5iGUt89VJ3G9a1H/Vm8BkmpGLbYMMuTdAb6OMfucGvgV8euy4JbfznIqRFnfMUz3h8tSgz00ccYwmw8VHaOW2jVr7pJNsS9nRO5o3aZDc+nkwh+ZcL7QFO7+Q5W0NCuvZSvM7z6T6UzMUu/GuUJBMfkJ6Yqmq6f/2ztoKm516ar7ia5XqH1m3FDA3Z0XdwKVYqa0psi7VGg3qPN+XfaFTZOHIrTBqZkVlH59pJvYfVDV630Tx5wHfXm6pv6vSgvwndQjNhusEyTEuu+cW0d0y7PHv8QSN4uubvKXp/Obd5Ol/RNmApixhNbk/LbDJbhNNp+JF+v7Ao56XB0z/qvXfZ\n\n### 💻 Code\n\n`bases.ts`\n\n```ts\nexport interface BaseA { a?: string; }\nexport interface BaseB { b?: number; }\n```\n\n`props.ts`\n\n```ts\nimport type { BaseA, BaseB } from \"./bases\";\n\nexport interface Props extends BaseA, BaseB {\n [key: string]: Props[keyof Props];\n}\n```\n\n`consumer.ts`\n\n```ts\nimport type { Props } from \"./props\";\n\nexport const key: keyof Props = 0;\n```\n\nCompile the three files together, for example `tsc --noEmit --checkers 1 bases.ts props.ts consumer.ts`.\n\n\n### 🙁 Actual behavior\n\nWith 3 or more checkers, including the default of 4, there's no error.\n\n### 🙂 Expected behavior\n\nThe same result at every checker count.\n\nThe `--singleThreaded` behavior makes sense to me, but honestly any behavior that can be made consistent across checkers count would be fine with me.\n\nWith 1 or 2 checkers, or `--singleThreaded`, or on TS6, we get:\n```\nconsumer.ts(3,14): error TS2322: Type '0' is not assignable to type 'keyof Props'.\n```\n\n### Additional information about the issue\n\nMy agent's analysis:\n\n-----\n\n| Version | `--singleThreaded` / `--checkers 1` | `--checkers 2` | `--checkers 3` | default (4) | `--checkers 8` |\n|---|---|---|---|---|---|\n| 6.0.3 (one checker) | TS2322 | n/a | n/a | n/a | n/a |\n| 7.0.2 | TS2322 | no error | no error | no error | no error |\n| 7.1.0-beta | TS2322 | TS2322 | no error | no error | no error |\n| main at 5e32f32 (Nov 16) | TS2322 | TS2322 | no error | no error | no error |\n| #65293 at 9a2e423 | TS2322 | TS2322 | no error | no error | no error |\n\nEach configuration gives the same result on every run (10 of 10 for every cell with 7.0.2, main and #65293), so this comes from how the files are split across checkers, not from a race.\n\nThis is the same kind of bug as #64998, but the cause is different: #65293 at 9a2e423 fixes #64998 but not this. With one base interface instead of two, 6.0.3 gives `string | number`, and #65293 makes every checker count agree with it. With two bases, 6.0.3 gives `\"a\" | \"b\"`, and #65293 still varies. In #65293's check-order harness, a compiler test of this case (below) gets the literal keys in the `default` order and `string | number` in `reverse`, `isolated` and `typesfirst`, and `TS_CHECK_ORDER_FUZZ=40` changes the result for 30 of 40 seeds.\n\nThe order dependence underneath is already in 6.0.3: within one file, the same interface gets a different `keyof` depending only on whether it's checked before its `keyof` is needed. Multiple checkers turn that into a dependence on the checker count. Here are both orders in one file. 6.0.3 and 7 both give `string | number` for the first and `\"a\" | \"b\"` for the second, so only the second assignment errors: [Playground (7.1.0-dev.20261030.1)](https://www.typescriptlang.org/play/v2/?ts=7.1.0-dev.20261030.1#code/v2/N4IghgxgLglgbgUwGIwDYJALhAegO4D2ATgNYDOADpAjmURDjAHYAmCAHgHRRkgA0IAGZoEvTKHzFyVCDToNmbLjyy4cAAh4R1ANk4AGTgGZ1YVuoAqAZXUB2dQApbnAIwGAtACMEUMH1PmALZgzKZk6gSC6gByBHDqLkYAlOpECBTEUBFMCOoIRETEmAA6TDga6uryjKwc3GQOAEwArHy2SZh5BcSWVo1GjY2dFgCeFLkA5PoT6jDhTARZYGRkMADmTGCe6JoEmmOTJAgjkeoACo0TnKXl6kcnUWcus+FkUETMa+oAPup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rgRE-BEgTyI0EICBgf5kXLQuY3DQQAAWWKOLHU3kExFyZhGUBJnz+CAQLHCkMejU452eZkp0LAaU0ZKqYECuSgBwClIITDhRJFuWIbCIESijNyEAIbHULBggkE+TI-jIewAkhNKRxxtAlWKJalRP9UFkaWrPIsSTyAOowRmKvGIIhgVDqUnk43+TUOyVMphfElgCjjJjhSCFFbqYTocIOPFx3JzMj-BBJa5MUrMKD5QTUdQAQXUwFKlUqYAA-J03h8EwBuUoAXyrTBrRDrsnUACFm62254u39AcCB0xh5WyhpObyYTk2WyqQh3fjnnNw2SIBTu+9mb8AUD8hXtWmIS5OtunuoALzqfSr6u1vWn4cDWrDhA2-gzi2TBtuoADa9zXr2awALqdE8CHHFCLgoau66KgS4QRpeB7UrSdxYVyu6smwLCdIiYDIr8iLoiAFYAeOQGNHk7CgeyjaQbOMFtphIxIZ8aHnI0olQo0uFDqUz5vHcQwUQ8Unfr+q78LghCkJQ1A4FocrCGsnAAFZmkwqjQZUiLaoEFAiEQADyFCwHKZCIp0tltoiPYwNA3maEQpZ8HOdkgL4RBrD4wWIqIOS8RiEWooEOougg8UgIlIGInOg7hcJiLMBAqD-GwwVwYinC0PQOAAFQNY1iIoQp1mFSAwarHKWCNIOQA)\n\nAs far as I can tell, resolving `Props`'s members evaluates its index signature, which computes `keyof Props` before the index signature exists and caches `\"a\" | \"b\"`. Computed after the members are resolved, `keyof Props` is `string | number`.\n\nThe playground links above are on tsgo.sxzz.dev because it runs the command-line compiler built to wasm, so it honors `\"checkers\"`. The official playground always shows the single-checker result here: its TS 7 mode goes through the project system, which doesn't use `checkers`.\n\n\u003cdetails>\n\u003csummary>Compiler test for #65293's check-order harness\u003c/summary>\n\n```ts\n// @strict: true\n// @noEmit: true\n// @checkOrder: default, reverse, isolated, typesfirst\n\n// The index signature of Props refers to keyof Props. keyof Props is only the\n// literal keys if it is computed while the members of Props are being resolved\n// (checking props.ts first), and string | number otherwise.\n\n// @filename: props.ts\ninterface BaseA { a?: string; }\ninterface BaseB { b?: number; c?: number[]; }\nexport interface Props extends BaseA, BaseB {\n [key: string]: Props[keyof Props];\n}\n\n// @filename: keys.ts\nimport {Props} from './props';\ntype PropKey = keyof Props;\nconst probe: never = null! as (number extends PropKey ? 'string | number' : 'literal keys only');\n```\n\n\u003c/details>","author":{"url":"https://github.com/blickly","@type":"Person","name":"blickly"},"datePublished":"2026-11-16T23:42:49Z","url":"https://github.com/microsoft/TypeScript/issues/65543"}
| 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:81fdae41-3fdb-b03a-5929-9ac6ec555755 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D8E2:34DB8F:801C03:ACC351:6B00E2DD |
| html-safe-nonce | cbca31fb7659d6bffac01571bcf13ccba6fe26e16c3bb0c8c1f2c4869ec8ad02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOEUyOjM0REI4Rjo4MDFDMDM6QUNDMzUxOjZCMDBFMkREIiwidmlzaXRvcl9pZCI6IjM1NzI3MTc3NTM2NjY2OTAyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0becf86d90597723835fa852a2ac3fb83cb8d6c77018bb74f2e943e12b851da5 |
| hovercard-subject-tag | issue:6433333417 |
| 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/65543/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6636a6ba08375cb77dd946b171d5bd584b40d91796ee45a1994d2641495c4288/microsoft/TypeScript/issues/65543 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6636a6ba08375cb77dd946b171d5bd584b40d91796ee45a1994d2641495c4288/microsoft/TypeScript/issues/65543 |
| og:image:alt | 🔎 Search Terms keyof index signature, index signature refers to its own keyof, self-referential index signature, circular keyof, Props[keyof Props], --checkers, --singleThreaded, checker assignment... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | blickly |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width