René's URL Explorer Experiment


Title: A list of suggested update to TypeScript's lib · Issue #49773 · microsoft/TypeScript · GitHub

Open Graph Title: A list of suggested update to TypeScript's lib · Issue #49773 · microsoft/TypeScript

X Title: A list of suggested update to TypeScript's lib · Issue #49773 · microsoft/TypeScript

Description: lib Update Request While working on uhyo/better-typescript-lib, I've found couples of issues in the built-in lib. While reflecting some of the changes there will cause compatibility issues and they are not included in the list below, oth...

Open Graph Description: lib Update Request While working on uhyo/better-typescript-lib, I've found couples of issues in the built-in lib. While reflecting some of the changes there will cause compatibility issues and they...

X Description: lib Update Request While working on uhyo/better-typescript-lib, I've found couples of issues in the built-in lib. While reflecting some of the changes there will cause compatibility issues and ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"A list of suggested update to TypeScript's lib","articleBody":"## lib Update Request\r\n\r\nWhile working on [uhyo/better-typescript-lib](https://github.com/uhyo/better-typescript-lib), I've found couples of issues in the built-in lib. While reflecting some of the changes there will cause compatibility issues and they are not included in the list below, others are worth reporting because either they are serious or they are not breaking changes. Here is the list:\r\n\r\n### es2015.collection.d.ts\r\n- [x] `WeakMapConstructor`: The type of `entries` should change from `readonly [K, V][] | null` to `readonly (readonly [K, V])[] | null` to keep it consistent with `MapConstructor`\r\n\r\n### es2015.core.d.ts\r\n- [x] `{Array\u003cT>, ReadonlyArray\u003cT>}.find`:\r\n  - The `this` parameter of the first parameter in the first overload is incorrectly typed `void`, which should be removed\r\n  - Missing documentation for the second overload\r\n- [x] `ArrayConstructor.from`: The first parameter should be renamed `source` to keep consistency across multiple overloads from other lib files. In `es2015.iterable.d.ts` it's written `iterable: Iterable\u003cT> | ArrayLike\u003cT>` and that's misleading. It's also named `source` in the [spec text](https://tc39.es/ecma262/#sec-array.from). (The documentation should be modify to `an array-like or iterable object` too to keep it the same across all files)\r\n- [ ] ~`NumberConstructor.{isFinite, isInteger, isNaN, isSafeInteger}`: Per the [spec](https://tc39.es/ecma262/#sec-properties-of-the-number-constructor), the return type can be changed to the type predicate `number is number`~ (Excluded unless https://github.com/microsoft/TypeScript/issues/15048 resolves)\r\n- [x] `ObjectConstructor.assign`: All parameters but the first should be made writable (`{ -readonly [P in keyof T]: T[P] }`).\r\n- [x] `ObjectConstructor.{getOwnPropertySymbols, setPrototypeOf}`: 🟠 The first parameter should extends `{}`. See the **es2017.object.d.ts** section below\r\n- [x] `String.normalize`: 🟠 Per the [spec](https://tc39.es/ecma262/#sec-string.prototype.normalize), the second overload should be removed to prevent a runtime error. The first parameter should then be made optional because it's defaulted to `\"NFC\"`.\r\n\r\n### es2015.iterable.d.ts\r\n- [x] `{ArrayConstructor, %TypedArray%Constructor}.from`: See the **es2015.core.d.ts** section above\r\n\r\n### es2015.reflect.d.ts\r\nCrossed out unless @uhyo thinks them worth changing and gives some illustrations.\r\n- [ ] ~`Reflect.construct`: `newTarget` can be widen to `any`~\r\n- [ ] ~`Reflect.getPrototypeOf`: The return type can be narrowed to `object`. It's impractical to get a `null` here~\r\n- [ ] ~`Reflect.setPrototypeOf`: `proto` can be widen to `any`~\r\n\r\n### es2015.symbol.wellknown.d.ts\r\n- [ ] ~`Array\u003cT>[Symbol.unscopables]`: Should be a record.~ (Fix already available in https://github.com/microsoft/TypeScript/pull/42566)\r\n\r\n### es2017.object.d.ts\r\n- [x] `Object.getOwnPropertyDescriptors`: 🟠 Per the [spec](https://tc39.es/ecma262/#sec-object-constructor), these methods start with either a `ToObject` or `RequireObjectCoercible` operation, which throws a `TypeError` with a nullish value. Starting from TypeScript 4.8 with https://github.com/microsoft/TypeScript/pull/49119, `{}` now precisely represents any nullish value. Thus, the first parameter of these methods should now be typed `{}` to prevent runtime errors.\r\n\r\n### es2019.array.d.ts\r\n- [x] `{Array\u003cT>, ReadonlyArray\u003cT>}.flatMap`: The `This` type parameter should be removed to keep consistency with other array prototype methods in the current library\r\n\r\n### es2020.bigint.d.ts\r\n- [x] `%TypedArray%.{every, find, findIndex, some}`: The return type of the first parameter can be widen to `any` to keep consistency with other array prototype methods\r\n- [x] `%TypedArray%Constructor.from`: Missing documentation for the second overload. Also see the **es2015.core.d.ts** section above\r\n\r\n### es2021.string.d.ts\r\n- [x] `String.replaceAll`: missing `{ [Symbol.replace] }` overloads. It should be defined exactly the same as `String.replace` (The documentation should be modify to `A string or RegExp search value` too to keep it the same across all files)\r\n\r\n### es2022.object.d.ts\r\n- [x] `Object.hasOwn`: Per the [spec](https://tc39.es/ecma262/#sec-object.hasown), `o` can be widen to `{}`\r\n\r\n### es5.d.ts\r\n- [x] `ObjectConstructor.{getPrototypeOf, getOwnPropertyDescriptor, getOwnPropertyNames}`: 🟠 The first parameter should extends `{}`. See the **es2017.object.d.ts** section above\r\n- [x] `{CallableFunction, NewableFunction}.apply`: Missing documentation for the second overload\r\n- [x] `{CallableFunction, NewableFunction}.bind`: Consider rewrite it like [what we've done](https://github.com/uhyo/better-typescript-lib/blob/2bcb3179c255f50443ac437ed888a696b0adb98a/lib/lib.es5.d.ts#L157-L183)\r\n- [ ] `{Array\u003cT>, ReadonlyArray\u003cT>}.every`: 🟠 The return type of the first overload can be typed `this is { [K in keyof this]: S }` to support tuples. ~Unlike other solutions, this change is small enough that it should not break anything.~ **It does affect some important tests, so a separate PR will be opened.**\r\n- [ ] `ReadonlyArray\u003cT>.map`: 🟠 The return type can be typed `{ -readonly [K in keyof this]: U }` to support tuples. **Will be in the follow-up PR**\r\n- [ ] `Array\u003cT>.map`: 🟠 The return type can be typed `{ [K in keyof this]: U }` to support tuples. **Will be in the follow-up PR**\r\n- [x] `{Array\u003cT>, ReadonlyArray\u003cT>}.{reduce, reduceRight}`: Missing documentation for the second overload\r\n- [x] `%TypedArray%.{find, findIndex}`: The return type of the first parameter can be widen to `any` to keep consistency with other array prototype methods\r\n- [x] `%TypedArray%Constructor.from`: See the **es2015.core.d.ts** section above\r\n\r\n##### 🟠 Breaking Changes (non-exhaustive)\r\n\r\nIf the TypeScript Team is fine with certain of these changes, I am happy to open a PR for it.\r\n\r\nThanks for reading till the end. That is all.\r\n\r\n---\r\n\r\n_P.S._ I am not sure if I shouldn't put all of the above into a single issue, but opening numerous issues to reflect all of these suggestions will be too many for me. I wonder how many PRs would be comfortable to the Team and how should I split it if I'm gonna work on this.\r\n","author":{"url":"https://github.com/graphemecluster","@type":"Person","name":"graphemecluster"},"datePublished":"2022-07-04T11:16:30Z","url":"https://github.com/microsoft/TypeScript/issues/49773"}

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:d6a24f8d-82ce-daa7-299a-98f5341276f8
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id88BA:158DF1:AC51BA:E3BAE0:6B01BCAE
html-safe-nonce136d6c21c39d36d4878c6f5f2f44a63f300fbe8e0337c7e9eead0b8191e8c765
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEJBOjE1OERGMTpBQzUxQkE6RTNCQUUwOjZCMDFCQ0FFIiwidmlzaXRvcl9pZCI6IjI4NzkwODkzNDAwNDYyMDQ2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9e647d8c343723b7cdf5eb37e468a06ebdf1083b09bdaedb5e3648d2f860e57f
hovercard-subject-tagissue:1293024096
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/49773/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ac17dd1f4f2c8060b5a6ba80c9c8e1f0ccca5b0d99f258ff649a32302d2276c3/microsoft/TypeScript/issues/49773
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ac17dd1f4f2c8060b5a6ba80c9c8e1f0ccca5b0d99f258ff649a32302d2276c3/microsoft/TypeScript/issues/49773
og:image:altlib Update Request While working on uhyo/better-typescript-lib, I've found couples of issues in the built-in lib. While reflecting some of the changes there will cause compatibility issues and they...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamegraphemecluster
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/49773#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F49773
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%2F49773
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/49773
Reloadhttps://github.com/microsoft/TypeScript/issues/49773
Reloadhttps://github.com/microsoft/TypeScript/issues/49773
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/49773
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/49773
#50452https://github.com/microsoft/TypeScript/pull/50452
A list of suggested update to TypeScript's libhttps://github.com/microsoft/TypeScript/issues/49773#top
#50452https://github.com/microsoft/TypeScript/pull/50452
Experience EnhancementNoncontroversial enhancementshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experience%20Enhancement%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Backloghttps://github.com/microsoft/TypeScript/milestone/29
https://github.com/graphemecluster
graphemecluster (graphemecluster)https://github.com/graphemecluster
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issue-1293024096
uhyo/better-typescript-libhttps://github.com/uhyo/better-typescript-lib
spec texthttps://tc39.es/ecma262/#sec-array.from
spechttps://tc39.es/ecma262/#sec-properties-of-the-number-constructor
Suggestion: one-sided or fine-grained type guards #15048https://github.com/microsoft/TypeScript/issues/15048
spechttps://tc39.es/ecma262/#sec-string.prototype.normalize
uhyo (@uhyo)https://github.com/uhyo
Fix definition of Array.prototype[Symbol.unscopables] #42566https://github.com/microsoft/TypeScript/pull/42566
spechttps://tc39.es/ecma262/#sec-object-constructor
Improve intersection reduction and CFA for truthy, equality, and typeof checks #49119https://github.com/microsoft/TypeScript/pull/49119
spechttps://tc39.es/ecma262/#sec-object.hasown
what we've donehttps://github.com/uhyo/better-typescript-lib/blob/2bcb3179c255f50443ac437ed888a696b0adb98a/lib/lib.es5.d.ts#L157-L183
https://github.com/MartinJohns
Martin Johns (MartinJohns)https://github.com/MartinJohns
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1173721404
spechttps://tc39.es/ecma262/#sec-properties-of-the-number-constructor
#39090 (comment)https://github.com/microsoft/TypeScript/issues/39090#issuecomment-644829480
https://github.com/graphemecluster
graphemecluster (graphemecluster)https://github.com/graphemecluster
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1173754196
Martin Johns (@MartinJohns)https://github.com/MartinJohns
https://github.com/MartinJohns
Martin Johns (MartinJohns)https://github.com/MartinJohns
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1173776165
what we've donehttps://github.com/uhyo/better-typescript-lib/blob/2bcb3179c255f50443ac437ed888a696b0adb98a/lib/lib.es2015.core.d.ts#L107
https://stackoverflow.com/questions/50374908https://stackoverflow.com/questions/50374908
#41857 (comment)https://github.com/microsoft/TypeScript/issues/41857#issuecomment-740102743
https://github.com/graphemecluster
graphemecluster (graphemecluster)https://github.com/graphemecluster
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1173843532
Martin Johns (@MartinJohns)https://github.com/MartinJohns
https://github.com/fatcerberus
Bruce Pascoe (fatcerberus)https://github.com/fatcerberus
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1173927983
https://github.com/graphemecluster
graphemecluster (graphemecluster)https://github.com/graphemecluster
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1173941728
Bruce Pascoe (@fatcerberus)https://github.com/fatcerberus
https://github.com/Josh-Cena
Joshua Chen (Josh-Cena)https://github.com/Josh-Cena
on Jul 4, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1174007978
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
Experience EnhancementNoncontroversial enhancementshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experience%20Enhancement%22
on Jul 5, 2022https://github.com/microsoft/TypeScript/issues/49773#event-6937851614
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Backloghttps://github.com/microsoft/TypeScript/milestone/29
on Jul 5, 2022https://github.com/microsoft/TypeScript/issues/49773#event-6937851814
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Jul 5, 2022https://github.com/microsoft/TypeScript/issues/49773#issuecomment-1175553736
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Jul 10, 2022https://github.com/microsoft/TypeScript/issues/49773#event-6965474447
Nathan Shively-Sanders (sandersn)https://github.com/sandersn
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#50453https://github.com/microsoft/TypeScript/pull/50453
on Apr 12, 2023https://github.com/microsoft/TypeScript/issues/49773#event-8990874962
https://github.com/wchargin
Willow Chargin (wchargin)https://github.com/wchargin
on May 13, 2024https://github.com/microsoft/TypeScript/issues/49773#issuecomment-2107966150
spechttps://tc39.es/ecma262/#sec-object.hasown
#50451https://github.com/microsoft/TypeScript/pull/50451
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/49773
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/49773
Experience EnhancementNoncontroversial enhancementshttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Experience%20Enhancement%22
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
SuggestionAn idea for TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Suggestion%22
BacklogNo due datehttps://github.com/microsoft/TypeScript/milestone/29
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.