Title: lib.d.ts Function.bind with this · Issue #28571 · microsoft/TypeScript · GitHub
Open Graph Title: lib.d.ts Function.bind with this · Issue #28571 · microsoft/TypeScript
X Title: lib.d.ts Function.bind with this · Issue #28571 · microsoft/TypeScript
Description: Search Terms Suggestion i don't know what is better name for ITSOverwriteThisFunction interface Function2 extends Function { bind
Open Graph Description: Search Terms Suggestion i don't know what is better name for ITSOverwriteThisFunction interface Function2 extends Function { bind
X Description: Search Terms Suggestion i don't know what is better name for ITSOverwriteThisFunction interface Function2 extends Function { bind<T extends any, F extends (...args: any[]) => any>(this...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/28571
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"lib.d.ts Function.bind with this","articleBody":"\u003c!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨\r\n\r\nHalf of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the \"Common Feature Requests\" section.\r\n\r\n--\u003e\r\n\r\n## Search Terms\r\n\r\n\u003c!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily --\u003e\r\n\r\n## Suggestion\r\n\r\ni don't know what is better name for `ITSOverwriteThisFunction`\r\n\r\n```ts\r\ninterface Function2 extends Function\r\n{\r\n\tbind\u003cT extends any, F extends (...args: any[]) =\u003e any\u003e(this: F, thisArg: T, ...argArray: any[]): ITSOverwriteThisFunction\u003cT, F\u003e;\r\n}\r\n\r\nexport type ITSOverwriteThisFunction\u003cT extends any, F extends (...args: any[]) =\u003e any\u003e =\r\n\t(this: T, ...args: Parameters\u003cF\u003e) =\u003e ReturnType\u003cF\u003e\r\n```\r\n\r\n## Use Cases\r\n\r\n\u003c!--\r\nWhat do you want to use this for?\r\nWhat shortcomings exist with current approaches?\r\n--\u003e\r\n\r\n1. we can now let `fn.bind`, know who is `this`\r\n\r\n\u003e problem: current typescript not support overload function, so this has limit\r\n\r\n\r\n## Examples\r\n\r\n\u003e this examples looks so stupid, but i don't know how to make look better\r\n\r\n```ts\r\nexport interface t4 extends Function2\r\n{\r\n\t(): string\r\n}\r\n\r\nexport declare let t5: t4\r\n\r\nexport let t6 = t5.bind([] as string[])\r\n\r\nt6 = function ()\r\n{\r\n\tthis.includes('') // =\u003e this is string[]\r\n\r\n\treturn ''\r\n}\r\n```\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [ ] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [ ] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [ ] This could be implemented without emitting different JS based on the types of the expressions\r\n* [ ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)\r\n* [ ] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n\r\n","author":{"url":"https://github.com/bluelovers","@type":"Person","name":"bluelovers"},"datePublished":"2018-11-16T07:38:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/28571/TypeScript/issues/28571"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f89d141b-9c67-fac4-5486-237bdc910e34 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9860:13EDA9:76A06F:A15CAC:6A62E14E |
| html-safe-nonce | 5f237eb7b33d5a6242f3b6a77b3bc44192c1274360d1bf94060d2b6ca848fdb4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5ODYwOjEzRURBOTo3NkEwNkY6QTE1Q0FDOjZBNjJFMTRFIiwidmlzaXRvcl9pZCI6Ijg3ODk0NzE2MzYxMjEzNzkxNTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e768de52d7a1c63f893f9a2ffd9a232c66efbeed534490458ca7729fe17ead31 |
| hovercard-subject-tag | issue:381480804 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/28571/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f64c5eb0789f48f56de5f793f38e4fe9768e435bdb3cbe427cc93fe6431e51f0/microsoft/TypeScript/issues/28571 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f64c5eb0789f48f56de5f793f38e4fe9768e435bdb3cbe427cc93fe6431e51f0/microsoft/TypeScript/issues/28571 |
| og:image:alt | Search Terms Suggestion i don't know what is better name for ITSOverwriteThisFunction interface Function2 extends Function { bind |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bluelovers |
| hostname | github.com |
| expected-hostname | github.com |
| None | df33b1b61ee7b9a0af988199bfc3503c9c1acafb1f1d40e1f140ea7c84f890dd |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d41cd1bdb290013455c0ac430fa755621733f5eb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width