René's URL Explorer Experiment


Title: [API Question] Parentheses affects declaration emit. Intentional? · Issue #32824 · microsoft/TypeScript · GitHub

Open Graph Title: [API Question] Parentheses affects declaration emit. Intentional? · Issue #32824 · microsoft/TypeScript

X Title: [API Question] Parentheses affects declaration emit. Intentional? · Issue #32824 · microsoft/TypeScript

Description: Consider the following snippet, /* The below types are exactly the same. The only difference is that one is wrapped in parentheses. The other is not. */ type InvalidKeys = { [P in K]? : never }; type Inval...

Open Graph Description: Consider the following snippet, /* The below types are exactly the same. The only difference is that one is wrapped in parentheses. The other is not. */ type InvalidKeys

X Description: Consider the following snippet, /* The below types are exactly the same. The only difference is that one is wrapped in parentheses. The other is not. */ type InvalidKeys<K extends string|number|...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[API Question] Parentheses affects declaration emit. Intentional?","articleBody":"Consider the following snippet,\r\n\r\n```ts\r\n/*\r\n    The below types are exactly the same.\r\n    The only difference is that one is wrapped in parentheses.\r\n    The other is not.\r\n*/\r\n\r\ntype InvalidKeys\u003cK extends string|number|symbol> = { [P in K]? : never };\r\ntype InvalidKeys2\u003cK extends string|number|symbol> = (\r\n    { [P in K]? : never }\r\n);\r\n\r\ntype A\u003cT> = (\r\n    T & InvalidKeys\u003c\"a\">\r\n);\r\ntype A2\u003cT> = (\r\n    T & InvalidKeys2\u003c\"a\">\r\n);\r\n\r\n/*\r\n    type a = {\r\n        x: number;\r\n    } & InvalidKeys\u003c\"a\">\r\n */\r\ntype a = A\u003c{ x : number }>;\r\n/*\r\n    type a2 = {\r\n        x: number;\r\n    } & {\r\n        a?: undefined;\r\n    }\r\n*/\r\ntype a2 = A2\u003c{ x : number }>;\r\n\r\n/*\r\n    One parentheses is all you need to change the output\r\n*/\r\n```\r\n\r\n[Playground](http://www.typescriptlang.org/play/#code/PQKgUABFECoBYFMICMEBsD2B3CAXAngA4IDOEAhgE5IIAe5AxrmvnohCeQLYIB0k0eEgwA7FhAAmASwBmMhNREMkUsrjjlcEUSrJZK5QsQkQpIiISoIR60qX7RY7DLcqmyIl-xDAwYAsQQAJIiAG7kaFISANII+CQAPNEQdLjWEmQkuJRmAOYAPiIArlyolPkk+KUYaAB8EAC8EADeEADaAAqm5tEAugD8EABcECIIoQoQAL4A3P5ESCHhkTFxJABMSSm0aSIZHNl5hSVlFVXINfVNABQCUK2d3RB9gyNjE25TYACUc-OBAEEEjArhBbo4YBAAGTBMIRKKxeIJABE5GRtR+cwCSABmxBjTBd1g0NhywRa02qPRmL8oCJ2IoBOaRMctDeJwUc0cUxJS3hqyRVIxEB8-yQ5AJQNatGGow5n1qczpjgZ5HWTJZ0DZctKnKJPJhzMcjnI-RGRT2CBkZgQEi50C+otV6qauIS0tlxV1Cr+yugAHkxhYrDZECRSO4KGg0BB8BgiqMELa8BgIAwNCJckhbNoirhCHmwD4gA)\r\n\r\nI've noticed that, sometimes, the presence/absence of parentheses can change the emitted type declaration. Is this intentional? If so, are there set rules for it? Can this behaviour be relied upon?\r\n\r\nThere are times where one would **want** the type to be expanded. And other times where one would **not** want the type to be expanded.\r\n\r\nHaving control over it would be nice. (I know I've wanted control over it plenty of times).\r\n\r\n-----\r\n\r\nI have encountered this discrepancy multiple times but this is the most recent example,\r\n(that inspired me to finally make this issue).\r\nhttps://github.com/microsoft/TypeScript/issues/20863#issuecomment-520551758\r\n\r\nThe `InvalidKeys` type is not expanded because I did not wrap the type in parentheses.\r\n\r\n-----\r\n\r\nObligatory @keithlayne , who hates unnecessary parentheses :trolleybus: ","author":{"url":"https://github.com/AnyhowStep","@type":"Person","name":"AnyhowStep"},"datePublished":"2019-08-12T19:50:49Z","url":"https://github.com/microsoft/TypeScript/issues/32824"}

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:f4b028f2-3c49-cc0e-740a-03cac0646c75
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC2EC:E3C4F:2A323FF:35D1608:6B01AF86
html-safe-nonce7344085af627fa60ea6c98910e3dcd5127d6af37b7591309641216e011298832
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkVDOkUzQzRGOjJBMzIzRkY6MzVEMTYwODo2QjAxQUY4NiIsInZpc2l0b3JfaWQiOiIyMjYwNTAyNTcwMjczNDUxOTEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacca809d175bfded068352c993d7e533361d1dbfa3612d0d99a0bbf627a73f8b1b
hovercard-subject-tagissue:479820236
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/32824/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d42cc78ff0ab1612e661eea5c56985b4c677480c2fb44da0505b98c3e7670a68/microsoft/TypeScript/issues/32824
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d42cc78ff0ab1612e661eea5c56985b4c677480c2fb44da0505b98c3e7670a68/microsoft/TypeScript/issues/32824
og:image:altConsider the following snippet, /* The below types are exactly the same. The only difference is that one is wrapped in parentheses. The other is not. */ type InvalidKeys
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameAnyhowStep
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/32824#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F32824
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%2F32824
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/32824
Reloadhttps://github.com/microsoft/TypeScript/issues/32824
Reloadhttps://github.com/microsoft/TypeScript/issues/32824
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/32824
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/32824
#32924https://github.com/microsoft/TypeScript/pull/32924
[API Question] Parentheses affects declaration emit. Intentional?https://github.com/microsoft/TypeScript/issues/32824#top
#32924https://github.com/microsoft/TypeScript/pull/32924
https://github.com/weswigham
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
TypeScript 3.7.0https://github.com/microsoft/TypeScript/milestone/98
https://github.com/AnyhowStep
AnyhowStephttps://github.com/AnyhowStep
on Aug 12, 2019https://github.com/microsoft/TypeScript/issues/32824#issue-479820236
Playgroundhttp://www.typescriptlang.org/play/#code/PQKgUABFECoBYFMICMEBsD2B3CAXAngA4IDOEAhgE5IIAe5AxrmvnohCeQLYIB0k0eEgwA7FhAAmASwBmMhNREMkUsrjjlcEUSrJZK5QsQkQpIiISoIR60qX7RY7DLcqmyIl-xDAwYAsQQAJIiAG7kaFISANII+CQAPNEQdLjWEmQkuJRmAOYAPiIArlyolPkk+KUYaAB8EAC8EADeEADaAAqm5tEAugD8EABcECIIoQoQAL4A3P5ESCHhkTFxJABMSSm0aSIZHNl5hSVlFVXINfVNABQCUK2d3RB9gyNjE25TYACUc-OBAEEEjArhBbo4YBAAGTBMIRKKxeIJABE5GRtR+cwCSABmxBjTBd1g0NhywRa02qPRmL8oCJ2IoBOaRMctDeJwUc0cUxJS3hqyRVIxEB8-yQ5AJQNatGGow5n1qczpjgZ5HWTJZ0DZctKnKJPJhzMcjnI-RGRT2CBkZgQEi50C+otV6qauIS0tlxV1Cr+yugAHkxhYrDZECRSO4KGg0BB8BgiqMELa8BgIAwNCJckhbNoirhCHmwD4gA
#20863 (comment)https://github.com/microsoft/TypeScript/issues/20863#issuecomment-520551758
Keith Layne (@keithlayne)https://github.com/keithlayne
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Wesley Wigham (weswigham)https://github.com/weswigham
on Aug 14, 2019https://github.com/microsoft/TypeScript/issues/32824#event-2555368574
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
on Aug 14, 2019https://github.com/microsoft/TypeScript/issues/32824#event-2555368601
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 3.7.0https://github.com/microsoft/TypeScript/milestone/98
on Aug 14, 2019https://github.com/microsoft/TypeScript/issues/32824#event-2555368686
https://github.com/weswigham
Wesley Wigham (weswigham)https://github.com/weswigham
on Aug 14, 2019https://github.com/microsoft/TypeScript/issues/32824#issuecomment-521127740
https://github.com/AnyhowStep
AnyhowStephttps://github.com/AnyhowStep
on Aug 14, 2019https://github.com/microsoft/TypeScript/issues/32824#issuecomment-521131173
https://github.com/weswigham
Wesley Wigham (weswigham)https://github.com/weswigham
on Aug 14, 2019https://github.com/microsoft/TypeScript/issues/32824#issuecomment-521132967
https://github.com/AnyhowStep
AnyhowStephttps://github.com/AnyhowStep
on Aug 15, 2019https://github.com/microsoft/TypeScript/issues/32824#issuecomment-521790993
Wesley Wigham (@weswigham)https://github.com/weswigham
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
https://user-images.githubusercontent.com/5655961/63125853-aa912680-bf7c-11e9-94a9-19841e0ede3a.png
https://user-images.githubusercontent.com/5655961/63125774-774e9780-bf7c-11e9-850d-c3bf84df68df.png
https://github.com/AnyhowStep
AnyhowStephttps://github.com/AnyhowStep
on Aug 15, 2019https://github.com/microsoft/TypeScript/issues/32824#issuecomment-521794704
#31824https://github.com/microsoft/TypeScript/issues/31824
microsoft/TypeScript-Website#38https://github.com/microsoft/TypeScript-Website/issues/38
Keith Layne (@keithlayne)https://github.com/keithlayne
https://user-images.githubusercontent.com/5655961/63126579-2e97de00-bf7e-11e9-8bdd-46402def49b3.png
Wesley Wigham (weswigham)https://github.com/weswigham
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
on Aug 15, 2019https://github.com/microsoft/TypeScript/issues/32824#event-2560851771
Wesley Wigham (weswigham)https://github.com/weswigham
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#32924https://github.com/microsoft/TypeScript/pull/32924
on Aug 20, 2019https://github.com/microsoft/TypeScript/issues/32824#event-2571375380
microsofthttps://github.com/microsoft
on Oct 21, 2025https://github.com/microsoft/TypeScript/issues/32824#event-20416747461
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/32824
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/32824
Wesley Wigham (weswigham)https://github.com/weswigham
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
TypeScript 3.7.0https://github.com/microsoft/TypeScript/milestone/98
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.