René's URL Explorer Experiment


Title: Improved control over mapped type modifiers by ahejlsberg · Pull Request #21919 · microsoft/TypeScript · GitHub

Open Graph Title: Improved control over mapped type modifiers by ahejlsberg · Pull Request #21919 · microsoft/TypeScript

X Title: Improved control over mapped type modifiers by ahejlsberg · Pull Request #21919 · microsoft/TypeScript

Description: Mapped types currently support adding a readonly or ? modifier to a mapped property, but they do not provide support the ability to remove modifiers. This matters in homomorphic mapped types (see #12563 and #12826) which by default preserve the modifiers of the underlying type. With this PR we provide the ability for a mapped type to either add or remove a particular modifier. Specifically, a readonly or ? property modifier in a mapped type can now be prefixed with either + or - to indicate that the modifier should be added or removed. Using this ability, the PR defines a new Required type in lib.d.ts. This type strips ? modifiers from all properties of T, thus making all properties required: type Required = { [P in keyof T]-?: T[P] }; Some examples of + and - on mapped type modifiers: type MutableRequired = { -readonly [P in keyof T]-?: T[P] }; // Remove readonly and ? type ReadonlyPartial = { +readonly [P in keyof T]+?: T[P] }; // Add readonly and ? A modifier with no + or - prefix is the same as a modifier with a + prefix. So, the ReadonlyPartial type above corresponds to type ReadonlyPartial = { readonly [P in keyof T]?: T[P] }; // Add readonly and ? In --strictNullChecks mode, when a homomorphic mapped type removes a ? modifier from a property in the underlying type it also removes undefined from the type of that property: type Foo = { a?: string }; // Same as { a?: string | undefined } type Bar = Required; // Same as { a: string } Fixes #15012.

Open Graph Description: Mapped types currently support adding a readonly or ? modifier to a mapped property, but they do not provide support the ability to remove modifiers. This matters in homomorphic mapped types (see #...

X Description: Mapped types currently support adding a readonly or ? modifier to a mapped property, but they do not provide support the ability to remove modifiers. This matters in homomorphic mapped types (see #...

Opengraph URL: https://github.com/microsoft/TypeScript/pull/21919

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

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/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:979d3fe6-8f33-e2cb-d477-cfcb42142284
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC618:345C43:78D97D:A4F6EB:6B05AC8B
html-safe-nonced95c23a913723302220f478e57d2e4f63b0f5ac9502e8de40ace37a0be8dc3c6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNjE4OjM0NUM0Mzo3OEQ5N0Q6QTRGNkVCOjZCMDVBQzhCIiwidmlzaXRvcl9pZCI6IjMzNTE3MDg5MjUzMDAxNTc1NzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac30cbaa40c5eb93e4e8bca6f853e56bb7de86baadead4ba5b92332cf54a9b2f0e
hovercard-subject-tagpull_request:168876888
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/microsoft/TypeScript/pull/21919/files
twitter:imagehttps://avatars.githubusercontent.com/u/4226954?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4226954?s=400&v=4
og:image:altMapped types currently support adding a readonly or ? modifier to a mapped property, but they do not provide support the ability to remove modifiers. This matters in homomorphic mapped types (see #...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec0b0a75b576b64dfa32421a785f31f49ed1e3a5d21b783307a7fd78864bf2e1d
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release6d5f39f9528ff412d5d29191dbe92c097ad1b33e
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/pull/21919/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fpull%2F21919%2Ffiles
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%2Fpull%2F21919%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/pull/21919/files
Reloadhttps://github.com/microsoft/TypeScript/pull/21919/files
Reloadhttps://github.com/microsoft/TypeScript/pull/21919/files
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests321 (321)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
Sign up for GitHub https://github.com/signup?return_to=%2Fmicrosoft%2FTypeScript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmicrosoft%2FTypeScript%2Fissues%2Fnew%2Fchoose
Anders Hejlsberg (ahejlsberg)https://github.com/ahejlsberg
masterhttps://github.com/microsoft/TypeScript/tree/master
mappedTypeModifiershttps://github.com/microsoft/TypeScript/tree/mappedTypeModifiers
Conversation 9 https://github.com/microsoft/TypeScript/pull/21919
Commits 5 https://github.com/microsoft/TypeScript/pull/21919/commits
Checks 0 https://github.com/microsoft/TypeScript/pull/21919/checks
Files changed https://github.com/microsoft/TypeScript/pull/21919/files
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/21919/files
Improved control over mapped type modifiers https://github.com/microsoft/TypeScript/pull/21919/files#top
Show all changes 5 commits https://github.com/microsoft/TypeScript/pull/21919/files
a629acd Allow +/- to prefix 'readonly' and '?' modifiers in mapped types ahejlsberg Feb 13, 2018 https://github.com/microsoft/TypeScript/pull/21919/commits/a629acd8fd4844742fdd01ab6cf55afa9377db0e
ebdd566 Accept baseline changes ahejlsberg Feb 13, 2018 https://github.com/microsoft/TypeScript/pull/21919/commits/ebdd566c094b3b2da68c2d402f7377024f977dd8
2cc1d73 Add Required to lib.d.ts ahejlsberg Feb 13, 2018 https://github.com/microsoft/TypeScript/pull/21919/commits/2cc1d735ec1bb725fce914d101b256108c530ad5
23162c2 Add tests ahejlsberg Feb 13, 2018 https://github.com/microsoft/TypeScript/pull/21919/commits/23162c2638444f3474d3f93529c12aa786303abd
57fe347 Accept new baselines ahejlsberg Feb 13, 2018 https://github.com/microsoft/TypeScript/pull/21919/commits/57fe3473d12e9b562d8d9605c55421ac90481957
Clear filters https://github.com/microsoft/TypeScript/pull/21919/files
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/21919/files
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/21919/files
checker.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
declarationEmitter.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-64eadce4ea37138aa45c66238f51670f3cbb0ee14d07c68ab5ef7713b0026ad0
emitter.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-537414476d7c7a690310c5e1e5d6a0bbbfba37c5b05126edee32fdea7e3a09d8
factory.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-aa7be70e4da2f4c99dd3bdfeda6e99ea1e8270cf51643ab462aa8a640d8c5c3a
parser.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-12a6724be007eb1a19d80018c7a63bbc73525ca793a9b3e5da49a4e86bbf457c
types.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-e9fd483341eea176a38fbd370590e1dc65ce2d9bf70bfd317c5407f04dba9560
es5.d.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-bc5657cc7554ca0c944ccc883a1334694829bce1293fd4fc5f2059cada6c003f
tsserverlibrary.d.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-d7739d440630d907a34b93d1905164a6f8fe27d2cc9d84c58495d02c886652d8
typescript.d.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-dd6d044fa72b2a5303fe2eb63efcf13ffbc5acc4420e5a4b1224ac4df7667e57
mappedTypes6.errors.txt https://github.com/microsoft/TypeScript/pull/21919/files#diff-2bf0965974dfc2108b4d0127552457ecae8d451605187815db2020896c651bc9
mappedTypes6.js https://github.com/microsoft/TypeScript/pull/21919/files#diff-4164d27e0c7140b546dd06a74a1e728ae545fcfd985efc4cfa4ec60bf5f3151a
mappedTypes6.symbols https://github.com/microsoft/TypeScript/pull/21919/files#diff-3e98a7789dc4d3b79264ee58f7b787779bf6811f2118df41294904fac4f99d31
mappedTypes6.types https://github.com/microsoft/TypeScript/pull/21919/files#diff-4470047a206457cd6400a98df9f1548a43eccbbe26c7c6d322532c2622f58953
mappedTypes6.ts https://github.com/microsoft/TypeScript/pull/21919/files#diff-eaa249eb25f4c90caa59dcd3bb3843d2918eb99c668500f7e9e1e8fb2b006f98
src/compiler/checker.tshttps://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
View file https://github.com/microsoft/TypeScript/blob/57fe3473d12e9b562d8d9605c55421ac90481957/src/compiler/checker.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/21919/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-d9ab6589e714c71e657f601cf30ff51dfc607fc98419bf72e04f6b0fa92cc4b8
src/compiler/declarationEmitter.tshttps://github.com/microsoft/TypeScript/pull/21919/files#diff-64eadce4ea37138aa45c66238f51670f3cbb0ee14d07c68ab5ef7713b0026ad0
View file https://github.com/microsoft/TypeScript/blob/57fe3473d12e9b562d8d9605c55421ac90481957/src/compiler/declarationEmitter.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/21919/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/21919/files#diff-64eadce4ea37138aa45c66238f51670f3cbb0ee14d07c68ab5ef7713b0026ad0
https://github.com/microsoft/TypeScript/pull/21919/files#diff-64eadce4ea37138aa45c66238f51670f3cbb0ee14d07c68ab5ef7713b0026ad0
src/compiler/emitter.tshttps://github.com/microsoft/TypeScript/pull/21919/files#diff-537414476d7c7a690310c5e1e5d6a0bbbfba37c5b05126edee32fdea7e3a09d8
View file https://github.com/microsoft/TypeScript/blob/57fe3473d12e9b562d8d9605c55421ac90481957/src/compiler/emitter.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/21919/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/21919/files#diff-537414476d7c7a690310c5e1e5d6a0bbbfba37c5b05126edee32fdea7e3a09d8
https://github.com/microsoft/TypeScript/pull/21919/files#diff-537414476d7c7a690310c5e1e5d6a0bbbfba37c5b05126edee32fdea7e3a09d8
src/compiler/factory.tshttps://github.com/microsoft/TypeScript/pull/21919/files#diff-aa7be70e4da2f4c99dd3bdfeda6e99ea1e8270cf51643ab462aa8a640d8c5c3a
View file https://github.com/microsoft/TypeScript/blob/57fe3473d12e9b562d8d9605c55421ac90481957/src/compiler/factory.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/microsoft/TypeScript/pull/21919/{{ revealButtonHref }}
https://github.com/microsoft/TypeScript/pull/21919/files#diff-aa7be70e4da2f4c99dd3bdfeda6e99ea1e8270cf51643ab462aa8a640d8c5c3a
https://github.com/microsoft/TypeScript/pull/21919/files#diff-aa7be70e4da2f4c99dd3bdfeda6e99ea1e8270cf51643ab462aa8a640d8c5c3a
https://github.com/microsoft/TypeScript/pull/21919/files#diff-aa7be70e4da2f4c99dd3bdfeda6e99ea1e8270cf51643ab462aa8a640d8c5c3a
Please reload this pagehttps://github.com/microsoft/TypeScript/pull/21919/files
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.