René's URL Explorer Experiment


Title: Support proposed ES Rest/Spread properties · Issue #2103 · microsoft/TypeScript · GitHub

Open Graph Title: Support proposed ES Rest/Spread properties · Issue #2103 · microsoft/TypeScript

X Title: Support proposed ES Rest/Spread properties · Issue #2103 · microsoft/TypeScript

Description: es7 proposal : https://github.com/sebmarkbage/ecmascript-rest-spread Spread properties Typing In my opinion the goal of this method is to be able to duplicate an object and changing some props, so I think it's particularly important in t...

Open Graph Description: es7 proposal : https://github.com/sebmarkbage/ecmascript-rest-spread Spread properties Typing In my opinion the goal of this method is to be able to duplicate an object and changing some props, so ...

X Description: es7 proposal : https://github.com/sebmarkbage/ecmascript-rest-spread Spread properties Typing In my opinion the goal of this method is to be able to duplicate an object and changing some props, so ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support proposed ES Rest/Spread properties","articleBody":"es7 proposal : https://github.com/sebmarkbage/ecmascript-rest-spread\n## Spread properties\n### Typing\n\nIn my opinion the goal of this method is to be able to duplicate an object and changing some props, so I think it's particularly important in this case to not check duplicate property declaration : \n\n``` typescript\nvar obj = { x: 1, y: 2};\nvar obj1 = {...obj, z: 3, y: 4}; // not an error\n```\n\nI have a very naive [type check algorithm](https://github.com/fdecampredon/jsx-typescript/blob/3c692cbb80622b74d1b308b3c5dcab6b993b4111/src/compiler/checker.ts#L5665-L5671) for a similar feature (`JSXSpreadAttribute`) in my little `jsx-typescript` fork: I just copy the properties of the _spread object_ in the properties table when I encounter a spread object, and override those property if I encounter a declaration with a similar name.\n### Emitting\n\n[jstransform](https://github.com/facebook/jstransform/) use `Object.assign`, [babel](https://babeljs.io/) introduce a shim: \n\n``` javascript\nvar _extends = Object.assign || function (target) { for (var i = 1; i \u003c arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n```\n\nWe could either force the presence of `assign` function on `ObjectConstructor` interface, or provide a similar function (with a different name).\n\nI think that the optimal solution would be to not emit any helper in `es6` target (or if `Object.assign` is defined), and to emit an helper function for `es5`, `es3`.\n\n``` javascript\nvar obj = { x: 1, y: 2};\nvar obj1 = {...obj, z: 3};\n\n/// ES6 emit\nvar obj = {x: 1, y: 2};\nvar obj1= Object.assign({}, obj, { z: 3 });\n\n//ES3 emit\nvar __assign = function (target) { \n    for (var i = 1; i \u003c arguments.length; i++) { \n        var source = arguments[i]; \n        for (var key in source) { \n            if (Object.prototype.hasOwnProperty.call(source, key)) { \n                target[key] = source[key];\n            } \n        } \n    } \n    return target; \n};\n\nvar obj = {x: 1, y: 2};\nvar obj1= __assign({}, obj, { z: 3 });\n```\n## Rest properties\n### Typing\n\nFor simple object the new type is a subtype of the assignation that does not contains properties that has been captured before the rest properties : \n\n``` typescript\nvar obj = {x:1, y: 1, z: 1};\nvar {z, ...obj1} = obj;\nobj1// {x: number; y:number};\n```\n\nIf the destructuring assignment has an index declaration, the result has also a similar index declaration: \n\n``` typescript\nvar obj: { [string: string]: string };\nvar {[excludedId], ...obj1} = obj;\nobj1// { [string: string]: string };\n```\n\nnew/call declarations are obviously not captured:\n\n``` typescript\nvar obj: { (): void; property: string};\nvar { ...obj1} = obj;\nobj1// { property: string };\n```\n### Emitting\n\nIt is not possible to emit _rest properties_ without an helper function, this one is from babel: \n\n``` typescript\nvar obj = {x:1, y: 1, z: 1};\nvar {z, ...obj1} = obj;\n```\n\n``` javascript\nvar __objectWithoutProperties = function(obj, keys) {\n    var target = {};\n    for (var i in obj) {\n        if (keys.indexOf(i) \u003e= 0) continue;\n        if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n        target[i] = obj[i];\n    }\n    return target;\n};\n\nvar obj = {x:1, y: 1, z: 1};\nvar z = obj.z;\nvar obj1 = __objectWithoutProperties(obj, [\"z\"]);\n```\n\n_Edit: added some little typing/emitting example_\n","author":{"url":"https://github.com/fdecampredon","@type":"Person","name":"fdecampredon"},"datePublished":"2015-02-21T21:31:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":96},"url":"https://github.com/2103/TypeScript/issues/2103"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:05d9155a-226c-9dff-9333-13af6e96e919
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB774:45C3A:ADB37:EDCA4:6A4D515F
html-safe-nonceb3505dba0adb203ef0acf6810ad8c1d0f6d1ffc9c76da1e6a3557128e05b6776
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzc0OjQ1QzNBOkFEQjM3OkVEQ0E0OjZBNEQ1MTVGIiwidmlzaXRvcl9pZCI6IjU2NjY2MjIyODU4MjY4Mjk3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac87975e66bc09c05cf697a359fb17835fb905d26e6390cae5e04d5547a344a50f
hovercard-subject-tagissue:58475863
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/2103/issue_layout
twitter:imagehttps://opengraph.githubassets.com/49b5ee41041016289001c1b1ae65f445b587d931dd84f2775f6053b7a92454d7/microsoft/TypeScript/issues/2103
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/49b5ee41041016289001c1b1ae65f445b587d931dd84f2775f6053b7a92454d7/microsoft/TypeScript/issues/2103
og:image:altes7 proposal : https://github.com/sebmarkbage/ecmascript-rest-spread Spread properties Typing In my opinion the goal of this method is to be able to duplicate an object and changing some props, so ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefdecampredon
hostnamegithub.com
expected-hostnamegithub.com
None92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6
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
release56fc8347865a14e2ec811533d68f929cf4e0ec19
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/2103#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F2103
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F2103
Sign up https://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/2103
Reloadhttps://github.com/microsoft/TypeScript/issues/2103
Reloadhttps://github.com/microsoft/TypeScript/issues/2103
Please reload this pagehttps://github.com/microsoft/TypeScript/issues/2103
microsoft https://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Notifications https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Fork 13.5k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Star 110k https://github.com/login?return_to=%2Fmicrosoft%2FTypeScript
Code https://github.com/microsoft/TypeScript
Issues 5k+ https://github.com/microsoft/TypeScript/issues
Pull requests 32 https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality 0 https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
Code https://github.com/microsoft/TypeScript
Issues https://github.com/microsoft/TypeScript/issues
Pull requests https://github.com/microsoft/TypeScript/pulls
Actions https://github.com/microsoft/TypeScript/actions
Projects https://github.com/microsoft/TypeScript/projects
Models https://github.com/microsoft/TypeScript/models
Wiki https://github.com/microsoft/TypeScript/wiki
Security and quality https://github.com/microsoft/TypeScript/security
Insights https://github.com/microsoft/TypeScript/pulse
#11150https://github.com/microsoft/TypeScript/pull/11150
Support proposed ES Rest/Spread propertieshttps://github.com/microsoft/TypeScript/issues/2103#top
#11150https://github.com/microsoft/TypeScript/pull/11150
https://github.com/sandersn
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES NextNew featurers for ECMAScript (a.k.a. ESNext)https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES%20Next%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/fdecampredon
fdecampredonhttps://github.com/fdecampredon
on Feb 21, 2015https://github.com/microsoft/TypeScript/issues/2103#issue-58475863
https://github.com/sebmarkbage/ecmascript-rest-spreadhttps://github.com/sebmarkbage/ecmascript-rest-spread
type check algorithmhttps://github.com/fdecampredon/jsx-typescript/blob/3c692cbb80622b74d1b308b3c5dcab6b993b4111/src/compiler/checker.ts#L5665-L5671
jstransformhttps://github.com/facebook/jstransform/
babelhttps://babeljs.io/
sandersnhttps://github.com/sandersn
CommittedThe team has roadmapped this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Committed%22
ES NextNew featurers for ECMAScript (a.k.a. ESNext)https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22ES%20Next%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.