Title: Index signature arguments are not type checked based on the specialized key type they are constrained to · Issue #7660 · microsoft/TypeScript · GitHub
Open Graph Title: Index signature arguments are not type checked based on the specialized key type they are constrained to · Issue #7660 · microsoft/TypeScript
X Title: Index signature arguments are not type checked based on the specialized key type they are constrained to · Issue #7660 · microsoft/TypeScript
Description: TypeScript Version: 1.8.7 Code type OnlyNumberKeys = {[key: number]: any}; let a: OnlyNumberKeys = {}; a["abcd"] = 1; // No error? let x = a["abcd"]; // No error? type OnlyStringKeys = {[key: string]: any}; let b: OnlyStringKeys = {}; b[...
Open Graph Description: TypeScript Version: 1.8.7 Code type OnlyNumberKeys = {[key: number]: any}; let a: OnlyNumberKeys = {}; a["abcd"] = 1; // No error? let x = a["abcd"]; // No error? type OnlyStringKeys = {[key: strin...
X Description: TypeScript Version: 1.8.7 Code type OnlyNumberKeys = {[key: number]: any}; let a: OnlyNumberKeys = {}; a["abcd"] = 1; // No error? let x = a["abcd"]; // No error? type OnlyStrin...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/7660
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Index signature arguments are not type checked based on the specialized key type they are constrained to","articleBody":"**TypeScript Version:** \n\n1.8.7\n\n**Code**\n\n``` ts\ntype OnlyNumberKeys = {[key: number]: any};\nlet a: OnlyNumberKeys = {};\n\na[\"abcd\"] = 1; // No error?\nlet x = a[\"abcd\"]; // No error?\n```\n\n``` ts\ntype OnlyStringKeys = {[key: string]: any};\nlet b: OnlyStringKeys = {};\n\nb[1234] = 1; // No error?\nlet y = b[1234]; // No error?\n```\n\n**Expected behavior:**\nShould error\n\n**Actual behavior:** \nDoesn't error\n\n_(Sorry if this is a duplicate but a search did not yield anything on this)_\n","author":{"url":"https://github.com/malibuzios","@type":"Person","name":"malibuzios"},"datePublished":"2016-03-23T20:58:56Z","url":"https://github.com/microsoft/TypeScript/issues/7660"}
| 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:ae572c33-9915-5505-5cc6-1d59a75a8199 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8D06:F85D1:4A56F:642DE:6AFBF501 |
| html-safe-nonce | cc6d4222302161d7da2bcb33bfdbb7b37052dad6fba7c25f7e68b56ccfbe900e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDA2OkY4NUQxOjRBNTZGOjY0MkRFOjZBRkJGNTAxIiwidmlzaXRvcl9pZCI6IjQxNDAxNjcxNTAyMDk1OTQ2MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d93963e22b11192b315dbc013a28cd60045672bc05c33710c796c69704fe8b93 |
| hovercard-subject-tag | issue:143078387 |
| 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/7660/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9a9f60a0abb1ad994395f657d3340d7d0e121c1ad32ade24d709b7e4760459ce/microsoft/TypeScript/issues/7660 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9a9f60a0abb1ad994395f657d3340d7d0e121c1ad32ade24d709b7e4760459ce/microsoft/TypeScript/issues/7660 |
| og:image:alt | TypeScript Version: 1.8.7 Code type OnlyNumberKeys = {[key: number]: any}; let a: OnlyNumberKeys = {}; a["abcd"] = 1; // No error? let x = a["abcd"]; // No error? type OnlyStringKeys = {[key: strin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | malibuzios |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| 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 | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width