René's URL Explorer Experiment


Title: Type checking does not works for indexable type with number keys OR string keys · Issue #34611 · microsoft/TypeScript · GitHub

Open Graph Title: Type checking does not works for indexable type with number keys OR string keys · Issue #34611 · microsoft/TypeScript

X Title: Type checking does not works for indexable type with number keys OR string keys · Issue #34611 · microsoft/TypeScript

Description: Try with newest TypeScript TypeScript Version: 3.7.0-dev.20191018 Result: has not been fixed. Search Terms: typescript indexable type string keys or number keys Code enum PROPERTIES_TYPES { NUMBER = "NUMBER", STRING = "STRING" // ETC. } ...

Open Graph Description: Try with newest TypeScript TypeScript Version: 3.7.0-dev.20191018 Result: has not been fixed. Search Terms: typescript indexable type string keys or number keys Code enum PROPERTIES_TYPES { NUMBER ...

X Description: Try with newest TypeScript TypeScript Version: 3.7.0-dev.20191018 Result: has not been fixed. Search Terms: typescript indexable type string keys or number keys Code enum PROPERTIES_TYPES { NUMBER ...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/34611

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type checking does not works for indexable type with number keys OR string keys","articleBody":"**Try with newest TypeScript**\r\n**TypeScript Version:** 3.7.0-dev.20191018\r\nResult: has not been fixed.\r\n\r\n**Search Terms:**\r\n`typescript indexable type string keys or number keys`\r\n\r\n**Code**\r\n```ts\r\nenum PROPERTIES_TYPES {\r\n  NUMBER = \"NUMBER\",\r\n  STRING = \"STRING\"\r\n  // ETC.\r\n}\r\n\r\ninterface IStringPropertySpecification {\r\n  type: PROPERTIES_TYPES.STRING;\r\n  required: boolean;\r\n  nullable?: boolean;\r\n  newName?: string;\r\n  emptyStringIsAllowed: boolean;\r\n  allowedValues?: Array\u003cstring>;\r\n  invalidValueSubstitution: string;\r\n  defaultValue?: string;\r\n}\r\n\r\ninterface IObjectDataSpecification__StringKeys {\r\n  nameForLogging: string;\r\n  properties: {\r\n    [propertyName: string]: IStringPropertySpecification;\r\n  };\r\n}\r\n\r\ninterface IObjectDataSpecification__NumberKeys {\r\n  nameForLogging: string;\r\n  properties: {\r\n    [propertyName: number]: IStringPropertySpecification;\r\n  };\r\n}\r\n\r\ntype ObjectDataSpecification = IObjectDataSpecification__StringKeys | IObjectDataSpecification__NumberKeys;\r\n\r\n\r\nconst dataSpecification: ObjectDataSpecification = {\r\n  nameForLogging: \"Test\",\r\n  properties: {\r\n    foo: \"asdfsadffsd\" // Valid!!! No type errors!\r\n  }\r\n};\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nThe error occurrence. I suppose, it must be:\r\n`TS2322 Type 'string' is not assignable to type ObjectDataSpecification`\r\n\r\n**Actual behavior:**\r\n\r\nTypeScript ignores this error. However, my PhpStorm knows right autocompletes: \r\n\r\n![Autocomplete](https://user-images.githubusercontent.com/41653501/67186891-f7cdc080-f423-11e9-87e9-fec02070a646.gif)\r\n\r\n**Playground Link:** https://jsfiddle.net/pfg1mq96/\r\n\r\n**Why I need so strange type as ObjectDataSpecification?**\r\n\r\nThe `ObjectDataSpecification` has been created for external data validation. It's known in advance, which type external data SHOULD be, but it's unknown in advance, which data ACTUALLY WILL BE. If data satisfies `ObjectDataSpecification`, it will be cast as below:\r\n\r\n```\r\nconst validData: IValidData = rawData as IValidData;\r\n```\r\n\r\nIn above case, `IValidData` will be:\r\n\r\n```\r\ninterface IValidData { foo: string; }\r\n```\r\n\r\nNormally, programmers should not create type like:\r\n\r\n```\r\ntype ConfusingType {\r\n  1: string;\r\n  foo: number;\r\n}\r\n```\r\n\r\nHowever I can't hope for high-quality API in the team work, The API team could define ANYTHING includes strange structure like above `ConfusingType` . Even it happens, I must to describe the `ConfusingType` with my `ObjectDataSpecification`. It will be:\r\n\r\n```\r\nconst dataSpecification: ObjectDataSpecification = {\r\n  nameForLogging: \"ConfusingType \",\r\n  properties: {\r\n    1: {\r\n      type: PROPERTIES_TYPES.STRING,\r\n      required: true,\r\n      emptyStringIsAllowed: false,\r\n      invalidValueSubstitution: \"---\"\r\n    },\r\n    foo: {\r\n      type: PROPERTIES_TYPES.NUMBER,\r\n      required: true,\r\n      numberType: NUMBER_TYPES.NATURAL_NUMBER,\r\n      invalidValueSubstitution: 1\r\n    }\r\n  }\r\n};\r\n```\r\n\r\nThen, my library validates external data according to `dataSpecification`.","author":{"url":"https://github.com/TokugawaTakeshi","@type":"Person","name":"TokugawaTakeshi"},"datePublished":"2019-10-21T08:16:50Z","url":"https://github.com/microsoft/TypeScript/issues/34611"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:114f6dab-0219-15cb-1f65-a725083a0661
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9E88:1F2D:2A1375:3544C2:6B00FF27
html-safe-nonce392e51c1bf458bf3c17da58eb643177b49708c9fdb8f94b30620e923cf4cffb5
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTg4OjFGMkQ6MkExMzc1OjM1NDRDMjo2QjAwRkYyNyIsInZpc2l0b3JfaWQiOiIxODE0NjE3NTY4MzIxNzk3OTI3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3d005b1eae3752975e20295ae5f3780611c5e0e3beeabfe5ae16998010dbeb6e
hovercard-subject-tagissue:509804080
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/34611/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f1fdaaaba902b8ee2e7a271cf1a4d8a1f8ccfa42065089fefe42884b51c5b020/microsoft/TypeScript/issues/34611
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f1fdaaaba902b8ee2e7a271cf1a4d8a1f8ccfa42065089fefe42884b51c5b020/microsoft/TypeScript/issues/34611
og:image:altTry with newest TypeScript TypeScript Version: 3.7.0-dev.20191018 Result: has not been fixed. Search Terms: typescript indexable type string keys or number keys Code enum PROPERTIES_TYPES { NUMBER ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameTokugawaTakeshi
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/34611#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F34611
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F34611
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/34611
Reloadhttps://github.com/microsoft/TypeScript/issues/34611
Reloadhttps://github.com/microsoft/TypeScript/issues/34611
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/34611
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/34611
#34927https://github.com/microsoft/TypeScript/pull/34927
Type checking does not works for indexable type with number keys OR string keyshttps://github.com/microsoft/TypeScript/issues/34611#top
#34927https://github.com/microsoft/TypeScript/pull/34927
https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
TypeScript 3.8.0https://github.com/microsoft/TypeScript/milestone/102
https://github.com/TokugawaTakeshi
TokugawaT_YD (TokugawaTakeshi)https://github.com/TokugawaTakeshi
on Oct 21, 2019https://github.com/microsoft/TypeScript/issues/34611#issue-509804080
https://user-images.githubusercontent.com/41653501/67186891-f7cdc080-f423-11e9-87e9-fec02070a646.gif
https://jsfiddle.net/pfg1mq96/https://jsfiddle.net/pfg1mq96/
TokugawaT_YD (TokugawaTakeshi)https://github.com/TokugawaTakeshi
on Oct 21, 2019https://github.com/microsoft/TypeScript/issues/34611#event-2728739334
TokugawaT_YD (TokugawaTakeshi)https://github.com/TokugawaTakeshi
on Oct 21, 2019https://github.com/microsoft/TypeScript/issues/34611#event-2728740073
https://github.com/dragomirtitian
Titian Cernicova-Dragomir (dragomirtitian)https://github.com/dragomirtitian
on Oct 21, 2019https://github.com/microsoft/TypeScript/issues/34611#issuecomment-544408551
Playhttps://www.typescriptlang.org/play/?ssl=19&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgJIDU4BsCuKDeAUMsgG7Z4BcyAzmFKAOaEC+hhoksiKAyvUwDSEAJ41k+ZMRLIA2gAcoAe3nQwIgHJwAthGp0GIRgF1qGChADcrax3DR4SZBpzaARtGFiJ0kguWqUOpautQgrh5QpmiYuFas7OqqyADybgBWEAhgACJwYHC8qgjAMMAI+cBKIMgAvMj8hoxe4gA+zhGeojS2hAjVdMgAJvmFxaXlldXUaZnZeQVFWRMVYFU19UQyyDBKStQARHA0QzA0cKdnQwfIAPS3yLHAQwCEb85KyEko0MpQNC8bIQgA
https://github.com/selipso
Yatit Thakker (selipso)https://github.com/selipso
on Oct 25, 2019https://github.com/microsoft/TypeScript/issues/34611#issuecomment-546196993
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 30, 2019https://github.com/microsoft/TypeScript/issues/34611#issuecomment-548085656
Yatit Thakker (@selipso)https://github.com/selipso
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
on Oct 30, 2019https://github.com/microsoft/TypeScript/issues/34611#event-2757444701
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Oct 30, 2019https://github.com/microsoft/TypeScript/issues/34611#event-2757444944
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 3.8.0https://github.com/microsoft/TypeScript/milestone/102
on Oct 30, 2019https://github.com/microsoft/TypeScript/issues/34611#event-2757445016
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Oct 30, 2019https://github.com/microsoft/TypeScript/issues/34611#issuecomment-548085966
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
https://github.com/ahejlsberg
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
on Nov 5, 2019https://github.com/microsoft/TypeScript/issues/34611#issuecomment-550001617
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Nov 5, 2019https://github.com/microsoft/TypeScript/issues/34611#event-2773048294
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#34927https://github.com/microsoft/TypeScript/pull/34927
on Nov 15, 2019https://github.com/microsoft/TypeScript/issues/34611#event-2803660323
https://github.com/TokugawaTakeshi
TokugawaT_YD (TokugawaTakeshi)https://github.com/TokugawaTakeshi
on Nov 16, 2019https://github.com/microsoft/TypeScript/issues/34611#issuecomment-554588819
Anders Hejlsberg (@ahejlsberg)https://github.com/ahejlsberg
microsofthttps://github.com/microsoft
on Oct 21, 2025https://github.com/microsoft/TypeScript/issues/34611#event-20416806542
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/34611
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/34611
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
TypeScript 3.8.0https://github.com/microsoft/TypeScript/milestone/102
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.