René's URL Explorer Experiment


Title: String literal types as index signature parameter types? · Issue #5683 · microsoft/TypeScript · GitHub

Open Graph Title: String literal types as index signature parameter types? · Issue #5683 · microsoft/TypeScript

X Title: String literal types as index signature parameter types? · Issue #5683 · microsoft/TypeScript

Description: According to #5185, string literal types are assignable to plain strings. Given the following type definition: type NodeType = "IfStatement" | "WhileStatement" | "ForStatement"; Both these assignments are valid: const nodeType1: NodeType...

Open Graph Description: According to #5185, string literal types are assignable to plain strings. Given the following type definition: type NodeType = "IfStatement" | "WhileStatement" | "ForStatement"; Both these assignme...

X Description: According to #5185, string literal types are assignable to plain strings. Given the following type definition: type NodeType = "IfStatement" | "WhileStatement" | "ForStatem...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"String literal types as index signature parameter types?","articleBody":"According to https://github.com/Microsoft/TypeScript/pull/5185, string literal types are assignable to plain strings. Given the following type definition:\n\n``` ts\ntype NodeType = \"IfStatement\"\n              | \"WhileStatement\"\n              | \"ForStatement\";\n```\n\nBoth these assignments are valid:\n\n``` ts\nconst nodeType1: NodeType = \"IfStatement\";\nconst nodeType2: string = nodeType1;\n```\n\nHowever, string literal types currently can't be used as index signature parameter types. Therefore, the compiler complains about the following code:\n\n``` ts\nlet keywords: { [index: NodeType]: string } = {\n    \"IfStatement\": \"if\",\n    \"WhileStatement\": \"while\",\n    \"ForStatement\": \"for\"\n};\n\n// error TS1023: An index signature parameter type must be 'string' or 'number'.\n```\n\nShouldn't that scenario be supported, given that string literal types are assignable to strings?\n\n/cc @DanielRosenwasser\n","author":{"url":"https://github.com/mariusschulz","@type":"Person","name":"mariusschulz"},"datePublished":"2015-11-16T14:38:46Z","url":"https://github.com/microsoft/TypeScript/issues/5683"}

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:b6aca229-3a82-3c17-f048-0ce35bf8f4bd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE410:1F855F:FF401E:160E483:6AFBFB18
html-safe-noncef552531accc63a7b0ec89be34f62b2b0c68dd9f4da0f5fb9747cfb8ebeaebd07
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDEwOjFGODU1RjpGRjQwMUU6MTYwRTQ4Mzo2QUZCRkIxOCIsInZpc2l0b3JfaWQiOiI2ODI0NTMzOTMzNjg2NTIwNjAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf0d357f57855612cab3ba1a4176c34a8b9b0468ab936876338df65212123ea53
hovercard-subject-tagissue:117138062
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/5683/issue_layout
twitter:imagehttps://opengraph.githubassets.com/dd34454416360b19232fb814f72e1770d4279f951ec7b8fa1fbb23c1061e284b/microsoft/TypeScript/issues/5683
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/dd34454416360b19232fb814f72e1770d4279f951ec7b8fa1fbb23c1061e284b/microsoft/TypeScript/issues/5683
og:image:altAccording to #5185, string literal types are assignable to plain strings. Given the following type definition: type NodeType = "IfStatement" | "WhileStatement" | "ForStatement"; Both these assignme...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemariusschulz
hostnamegithub.com
expected-hostnamegithub.com
Nonefa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f
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
releaseb3b5633a74535d9c23385512d534c66c8fde1907
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/5683#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F5683
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%2F5683
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/5683
Reloadhttps://github.com/microsoft/TypeScript/issues/5683
Reloadhttps://github.com/microsoft/TypeScript/issues/5683
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests335 (335)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/pulse
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/5683
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/5683
String literal types as index signature parameter types?https://github.com/microsoft/TypeScript/issues/5683#top
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Literal%20Types%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
TypeScript 2.1.4https://github.com/microsoft/TypeScript/milestone/31
https://github.com/mariusschulz
Marius Schulz (mariusschulz)https://github.com/mariusschulz
on Nov 16, 2015https://github.com/microsoft/TypeScript/issues/5683#issue-117138062
#5185https://github.com/microsoft/TypeScript/pull/5185
Daniel Rosenwasser (@DanielRosenwasser)https://github.com/DanielRosenwasser
Nexthttps://github.com/microsoft/TypeScript/issues/5683?timeline_page=1
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
In DiscussionNot yet reached consensushttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22In%20Discussion%22
on Nov 17, 2015https://github.com/microsoft/TypeScript/issues/5683#event-466116358
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Nov 17, 2015https://github.com/microsoft/TypeScript/issues/5683#issuecomment-157217824
#2491https://github.com/microsoft/TypeScript/issues/2491
Wesley Wigham (@weswigham)https://github.com/weswigham
https://github.com/mariusschulz
Marius Schulz (mariusschulz)https://github.com/mariusschulz
on Nov 17, 2015https://github.com/microsoft/TypeScript/issues/5683#issuecomment-157347017
Esprimahttps://github.com/jquery/esprima
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Nov 17, 2015https://github.com/microsoft/TypeScript/issues/5683#issuecomment-157456174
#5185https://github.com/microsoft/TypeScript/pull/5185
https://github.com/jhlange
Joshua Lange (jhlange)https://github.com/jhlange
on Dec 21, 2015https://github.com/microsoft/TypeScript/issues/5683#issuecomment-166231552
#2491https://github.com/microsoft/TypeScript/issues/2491
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Dec 21, 2015https://github.com/microsoft/TypeScript/issues/5683#issuecomment-166429607
Joshua Lange (@jhlange)https://github.com/jhlange
#2491https://github.com/microsoft/TypeScript/issues/2491
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Literal%20Types%22
on Jan 25, 2016https://github.com/microsoft/TypeScript/issues/5683#event-525635048
https://github.com/ambition-consulting
John-Paul Cunliffe (ambition-consulting)https://github.com/ambition-consulting
on Mar 11, 2016https://github.com/microsoft/TypeScript/issues/5683#issuecomment-195357393
https://github.com/malibuzios
malibuzioshttps://github.com/malibuzios
on Mar 23, 2016https://github.com/microsoft/TypeScript/issues/5683#issuecomment-200543120
#7656https://github.com/microsoft/TypeScript/issues/7656
https://github.com/malibuzios
malibuzioshttps://github.com/malibuzios
on Mar 24, 2016https://github.com/microsoft/TypeScript/issues/5683#issuecomment-200729384
this commenthttps://github.com/Microsoft/TypeScript/issues/7660#issuecomment-200725073
#7660https://github.com/microsoft/TypeScript/issues/7660
https://github.com/malibuzios
malibuzioshttps://github.com/malibuzios
on Mar 24, 2016https://github.com/microsoft/TypeScript/issues/5683#issuecomment-200800307
This commenthttps://github.com/Microsoft/TypeScript/issues/7660#issuecomment-200786716
#7660https://github.com/microsoft/TypeScript/issues/7660
https://github.com/zakjan
Jan Žák (zakjan)https://github.com/zakjan
on Mar 30, 2016https://github.com/microsoft/TypeScript/issues/5683#issuecomment-203493767
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Jun 7, 2016https://github.com/microsoft/TypeScript/issues/5683#issuecomment-224180766
Christy Haragan (@christyharagan)https://github.com/christyharagan
#8336https://github.com/microsoft/TypeScript/issues/8336
malibuzioshttps://github.com/malibuzios
#7722https://github.com/microsoft/TypeScript/issues/7722
https://github.com/asakusuma
Asa Kusuma (asakusuma)https://github.com/asakusuma
on Jun 25, 2016https://github.com/microsoft/TypeScript/issues/5683#issuecomment-228497288
Marius Schulz (@mariusschulz)https://github.com/mariusschulz
https://github.com/karol-majewski
Karol Majewski (karol-majewski)https://github.com/karol-majewski
on Jul 28, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-515784837
Lukas Bombach (@LukasBombach)https://github.com/LukasBombach
https://github.com/LukasBombach
Lukas Bombach (LukasBombach)https://github.com/LukasBombach
on Jul 31, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-516873129
Karol Majewski (@karol-majewski)https://github.com/karol-majewski
https://github.com/joeskeen
Joe Skeen (joeskeen)https://github.com/joeskeen
on Sep 18, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-532810397
https://user-images.githubusercontent.com/12286274/65175459-2402b580-da10-11e9-8e8c-b5f59dfef7a7.png
https://github.com/blujedis
blujedishttps://github.com/blujedis
on Sep 18, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-532815142
https://github.com/blujedis
blujedishttps://github.com/blujedis
on Sep 18, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-532818642
https://github.com/joeskeen
Joe Skeen (joeskeen)https://github.com/joeskeen
on Sep 18, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-532830150
https://github.com/blujedis
blujedishttps://github.com/blujedis
on Sep 18, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-532834964
https://github.com/omidkrad
Omid K. Rad (omidkrad)https://github.com/omidkrad
on Oct 4, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-538559199
#6579 (comment)https://github.com/microsoft/TypeScript/issues/6579#issuecomment-537306546
https://github.com/MajidJafari
Majid Jafari (MajidJafari)https://github.com/MajidJafari
on Oct 5, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-538646952
Marius Schulz (@mariusschulz)https://github.com/mariusschulz
https://github.com/apieceofbart
Bartek (apieceofbart)https://github.com/apieceofbart
on Nov 20, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-556066396
Marius Schulz (@mariusschulz)https://github.com/mariusschulz
https://github.com/SanCoder-Q
JmQu (SanCoder-Q)https://github.com/SanCoder-Q
on Dec 5, 2019https://github.com/microsoft/TypeScript/issues/5683#issuecomment-561963505
https://github.com/colxi
Sergi Guzman (colxi)https://github.com/colxi
on Jan 19, 2020https://github.com/microsoft/TypeScript/issues/5683#issuecomment-576036595
typescript playgroundhttps://www.typescriptlang.org/play/#code/LAKALgngDgpgBAOQPYBMYBVrwLxwOQCSAZgMpgCGYMAtjAHZh5wA++A6gBYCWANjGZRr1GLfADEkAJwFVaDPKEixEqDFgDyAIwBWMAMZg4uAEr6pKADzI0mWABo4AZzCSudAOYA+UKAD0vuAB3KQBrR1AAN3JJOGoIazVYLV0DAC4VGw0dfUNcAG9QODhiGSEGdLwuIjw7QrhOXn4KWWEKwO4+GrqJaWaysAqiKS6QAF8fEH84PSRqKB5yN0c4KrgwDhhJeGj4ai5HRzd3OChJJBhTsC4YcJAomLiE2xhknPSnrJTcuAKQIpK+nIBvgqiMig0+KUgW0OjARqM4FMALRIzxwACikjOMXSAAUzrBJJBxFIocImPs4FsAI4AVy4WxQKzoayw+FMM0klg+9icLiOnjwADoJlMAMKzeaLOjLVbkFAoLhXJB0cg8E4EzZXG5wHZwIa0ugoSLRWLxVTPV5pDKJF7ZAxGH51AGCaEg6q1P71WFk8r4dqNMFwHq+4F4IaSINDJBwVJ4TTRJiIgIotGY7GxorhpBIJgoc7LOhIQwwAAe+0MblZyjwHPMVgtWAczlcHkFIrGoCAA
https://github.com/LukasBombach
Lukas Bombach (LukasBombach)https://github.com/LukasBombach
on Jan 20, 2020https://github.com/microsoft/TypeScript/issues/5683#issuecomment-576169183
Playgroundhttps://www.typescriptlang.org/play/?ssl=18&ssc=2&pln=12&pc=1#code/LAKALgngDgpgBAOQPYBMYBVrwLxwOQCSAZgMpgCGYMAtjAHZh5wA++A6gBYCWANjGZRr1GLfADEkAJwFVaDPKEixEqDFgDyAIwBWMAMZg4uAEr6pKADzI0mWABo4AZzCSudAOYA+UKAD0vuAB3KQBrR1AAN3JJOGoIazVYLV0DAC4VGw0dfUNcAG9QODhiGSEGdLwuIjw7QrhOXn4KWWEKwO4+GrqJaWaysAqiKS6QAF8fECIAVzoDLiQ6OHcYMARyWjFJJGoANXIeKZgACmdJdNO3dwBKdITbeFYZtCI3GBQ4ApAioZijvQXnHAQnA3LF4qp7skcldPkUilU4Ec4ncsikwABtEIAXSM2FwpyuHzg-jg5DoEDqcLgkhWU0kixCAG5iQEuI5SU4XJdKXBxl9eaA+UA
#5683 (comment)https://github.com/microsoft/TypeScript/issues/5683#issuecomment-515744911
https://github.com/loqusion
John Bernard (loqusion)https://github.com/loqusion
on May 19, 2021https://github.com/microsoft/TypeScript/issues/5683#issuecomment-843778914
template literal typeshttps://www.typescriptlang.org/docs/handbook/2/template-literal-types.html
https://github.com/jods4
jods (jods4)https://github.com/jods4
on Jun 10, 2021https://github.com/microsoft/TypeScript/issues/5683#issuecomment-858777980
Flandre-Xhttps://github.com/Flandre-X
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/5683
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/5683
Domain: Literal TypesUnit types including string literal types, numeric literal types, Boolean literals, null, undefinedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Literal%20Types%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
TypeScript 2.1.4https://github.com/microsoft/TypeScript/milestone/31
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.