Title: Incorrect/overly strong `this` inference for POJOs · Issue #8191 · microsoft/TypeScript · GitHub
Open Graph Title: Incorrect/overly strong `this` inference for POJOs · Issue #8191 · microsoft/TypeScript
X Title: Incorrect/overly strong `this` inference for POJOs · Issue #8191 · microsoft/TypeScript
Description: TypeScript Version: nightly (1.9.0-dev.20160419) Code Ember.Object.extend({ init() { this._super(); // ^~~~ error TS2339: Property '_super' does not exist on type '{ init(): void; }'. ... } }); Expected behavior: this should be inferred ...
Open Graph Description: TypeScript Version: nightly (1.9.0-dev.20160419) Code Ember.Object.extend({ init() { this._super(); // ^~~~ error TS2339: Property '_super' does not exist on type '{ init(): void; }'. ... } }); Exp...
X Description: TypeScript Version: nightly (1.9.0-dev.20160419) Code Ember.Object.extend({ init() { this._super(); // ^~~~ error TS2339: Property '_super' does not exist on type '{ init(): void; }'...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/8191
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incorrect/overly strong `this` inference for POJOs","articleBody":"**TypeScript Version:** \n\nnightly (1.9.0-dev.20160419)\n\n**Code**\n\n``` ts\nEmber.Object.extend({\n init() {\n this._super();\n// ^~~~ error TS2339: Property '_super' does not exist on type '{ init(): void; }'.\n ...\n }\n});\n```\n\n**Expected behavior:**\n\n`this` should be inferred as `any`\n\n**Actual behavior:**\n\n`this` is inferred to be `{ init(): void; }`\n\n---\n\nThis changed somewhere between `typescript@1.9.0-dev.20160319` and `typescript@1.9.0-dev.20160419`. I believe it is unsafe to assume anything about the `this` on the \"methods\" on a POJO, as there are several common patterns in JavaScript that breaks this assumption (using POJOs as an \"options\" or \"extensions\" dictionary).\n","author":{"url":"https://github.com/chancancode","@type":"Person","name":"chancancode"},"datePublished":"2016-04-19T19:42:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":21},"url":"https://github.com/8191/TypeScript/issues/8191"}
| 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:b9826940-f9dd-7f58-0026-2607bad0a451 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E36:1090D2:FBB3F5:16AABFB:6A632CBE |
| html-safe-nonce | 7a3ab91371c815dc3d75f117107219030ce6cf64f0c934d5f5f8382c199ab331 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTM2OjEwOTBEMjpGQkIzRjU6MTZBQUJGQjo2QTYzMkNCRSIsInZpc2l0b3JfaWQiOiI2NDM0MTAyNDE0MTI0NzIzMzkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c379f98859896353e29b510a11f6e88538cf8765d291eae89009c1ac9a566e33 |
| hovercard-subject-tag | issue:149561931 |
| 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/8191/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39ead3165465c1f03ad9cec29aca1b633e79e48655b585cb9cf36ffb04714867/microsoft/TypeScript/issues/8191 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39ead3165465c1f03ad9cec29aca1b633e79e48655b585cb9cf36ffb04714867/microsoft/TypeScript/issues/8191 |
| og:image:alt | TypeScript Version: nightly (1.9.0-dev.20160419) Code Ember.Object.extend({ init() { this._super(); // ^~~~ error TS2339: Property '_super' does not exist on type '{ init(): void; }'. ... } }); Exp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chancancode |
| hostname | github.com |
| expected-hostname | github.com |
| None | 30c644d502bce6cd2e59f9000b4744f2b64819abea8e8f959b18e3ad793125aa |
| 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 | 331492a48ebd91d66ef2de38e1901bb911c9fe9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width