Title: Add explicit error to __extends when base class is undefined · Issue #5794 · microsoft/TypeScript · GitHub
Open Graph Title: Add explicit error to __extends when base class is undefined · Issue #5794 · microsoft/TypeScript
X Title: Add explicit error to __extends when base class is undefined · Issue #5794 · microsoft/TypeScript
Description: We occasionally get people in the IRC channel asking about their transpiled JS failing with TypeError: undefined is not an object. It happens when accessing b.prototype inside __extends because the child class is before the base class, b...
Open Graph Description: We occasionally get people in the IRC channel asking about their transpiled JS failing with TypeError: undefined is not an object. It happens when accessing b.prototype inside __extends because the...
X Description: We occasionally get people in the IRC channel asking about their transpiled JS failing with TypeError: undefined is not an object. It happens when accessing b.prototype inside __extends because the...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/5794
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add explicit error to __extends when base class is undefined","articleBody":"We occasionally get people in the IRC channel asking about their transpiled JS failing with `TypeError: undefined is not an object`. It happens when accessing `b.prototype` inside `__extends` because the child class is before the base class, but they often think it's a bug in `__extends`. Would it make sense to detect if `b` is undefined at the start of the function and throw an appropriately worded error? Eg:\n\n``` typescript\nvar __extends = this.__extends || function (d, b) {\n if (b === undefined) { throw new Error(\"The base class is not defined. Did you put the child class before the base class?\"); }\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};\n```\n","author":{"url":"https://github.com/Arnavion","@type":"Person","name":"Arnavion"},"datePublished":"2015-11-25T18:08:09Z","url":"https://github.com/microsoft/TypeScript/issues/5794"}
| 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:adc4a630-ff4b-8cd5-bbb5-61e7f7d77d88 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8906:3DCD28:9F77D:D6B66:6B0181B7 |
| html-safe-nonce | 874dc1cf664e5629057b43719237ad0dd64fa17117343597be35d02f33dfd809 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTA2OjNEQ0QyODo5Rjc3RDpENkI2Njo2QjAxODFCNyIsInZpc2l0b3JfaWQiOiI3MDY4MjM0OTU2NDk3MDYwMjc5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | bc7e603f87d6215e422fe6e6070da4055931848dbfe2942b99230dbd1eee135c |
| hovercard-subject-tag | issue:118893337 |
| 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/5794/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8dd62c08af8c73c0d719425bb6cd5c45da676ab18dde320d9af86953643d934c/microsoft/TypeScript/issues/5794 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8dd62c08af8c73c0d719425bb6cd5c45da676ab18dde320d9af86953643d934c/microsoft/TypeScript/issues/5794 |
| og:image:alt | We occasionally get people in the IRC channel asking about their transpiled JS failing with TypeError: undefined is not an object. It happens when accessing b.prototype inside __extends because the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Arnavion |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width