Title: Support specifying type of "this" in function implementations · Issue #229 · microsoft/TypeScript · GitHub
Open Graph Title: Support specifying type of "this" in function implementations · Issue #229 · microsoft/TypeScript
X Title: Support specifying type of "this" in function implementations · Issue #229 · microsoft/TypeScript
Description: Migrated issue from codeplex: https://typescript.codeplex.com/workitem/507 Currently typescript will type the "this" pointer in function callbacks as "any." Arrow syntax lets us capture "this" from the outer scope, and this can enable pr...
Open Graph Description: Migrated issue from codeplex: https://typescript.codeplex.com/workitem/507 Currently typescript will type the "this" pointer in function callbacks as "any." Arrow syntax lets us capture "this" from...
X Description: Migrated issue from codeplex: https://typescript.codeplex.com/workitem/507 Currently typescript will type the "this" pointer in function callbacks as "any." Arrow syntax lets us...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/229
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support specifying type of \"this\" in function implementations","articleBody":"Migrated issue from codeplex: https://typescript.codeplex.com/workitem/507\n\nCurrently typescript will type the \"this\" pointer in function callbacks as \"any.\" Arrow syntax lets us capture \"this\" from the outer scope, and this can enable proper typing. It would be nice to be able to provide\nan optional \"ambient this\" declaration in function signatures:\n\n```\n(declare this : MyType, first: number, second: string) : any;\n```\n\nThe rules would be:\n\n1) the declaration is obviously optional\n2) if specified, should be first parameter\n3) cannot be used with arrow syntax lambdas (should be compiler error)\n\nI know you can cast as needed to get the intellisense but I'd rather not put this responsibility on the implementer of the function. Ideally it should be part of the definition.\n\nExample with Sammy:\n\n```\nvar app = $.sammy(\"#view\", function() {\n // define default route\n this.get(\"#/\", function() { ... } \n});\n```\n\nIn the above case, typescript can only type this as any.\n\nThoughts?\n","author":{"url":"https://github.com/abergs","@type":"Person","name":"abergs"},"datePublished":"2014-07-24T11:04:25Z","url":"https://github.com/microsoft/TypeScript/issues/229"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c3e0564e-6b03-6252-2a93-03352414f281 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D10E:76282:EF9D69:14BE9DB:6AFBF686 |
| html-safe-nonce | ed65ec5ff3dcf194b49d4e0611bbeb11ecafa320fd8e5d59cf99cbe3efb4f47e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTBFOjc2MjgyOkVGOUQ2OToxNEJFOURCOjZBRkJGNjg2IiwidmlzaXRvcl9pZCI6IjgzNTU5MjI1OTYyOTc3MDA5OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | aa6e17af30e51e7b409bd121dfe5463ec74811b73d66f17e6454975072d10131 |
| hovercard-subject-tag | issue:38618139 |
| 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/229/issue_layout |
| twitter:image | https://opengraph.githubassets.com/57ed87163563ca1bc20e84de7949cb2a86332b8676800a9e73b05f578a8a2e0e/microsoft/TypeScript/issues/229 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/57ed87163563ca1bc20e84de7949cb2a86332b8676800a9e73b05f578a8a2e0e/microsoft/TypeScript/issues/229 |
| og:image:alt | Migrated issue from codeplex: https://typescript.codeplex.com/workitem/507 Currently typescript will type the "this" pointer in function callbacks as "any." Arrow syntax lets us capture "this" from... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | abergs |
| hostname | github.com |
| expected-hostname | github.com |
| None | fa74413a1d84dac536fcca0740780bcbd3207bafec0e51873b73ff8e8cca032f |
| 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 | b3b5633a74535d9c23385512d534c66c8fde1907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width