Title: In JS, prototype assignment to property of expando type changes type reference · Issue #27146 · microsoft/TypeScript · GitHub
Open Graph Title: In JS, prototype assignment to property of expando type changes type reference · Issue #27146 · microsoft/TypeScript
X Title: In JS, prototype assignment to property of expando type changes type reference · Issue #27146 · microsoft/TypeScript
Description: var UI = {} UI.Hunch = class { constructor() { } } UI.Hunch.Provider = function() {}; UI.Hunch.Provider.prototype = { /** * @return {void} */ item() {} }; /** * @returns {UI.Hunch} */ function failure() { return new UI.Hunch(); } Expecte...
Open Graph Description: var UI = {} UI.Hunch = class { constructor() { } } UI.Hunch.Provider = function() {}; UI.Hunch.Provider.prototype = { /** * @return {void} */ item() {} }; /** * @returns {UI.Hunch} */ function fail...
X Description: var UI = {} UI.Hunch = class { constructor() { } } UI.Hunch.Provider = function() {}; UI.Hunch.Provider.prototype = { /** * @return {void} */ item() {} }; /** * @returns {UI.Hunch} */ function fail...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/27146
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"In JS, prototype assignment to property of expando type changes type reference","articleBody":"```js\r\nvar UI = {}\r\nUI.Hunch = class {\r\n constructor() {\r\n }\r\n}\r\nUI.Hunch.Provider = function() {};\r\nUI.Hunch.Provider.prototype = {\r\n /**\r\n * @return {void}\r\n */\r\n item() {}\r\n};\r\n\r\n/**\r\n * @returns {UI.Hunch}\r\n */\r\nfunction failure() {\r\n return new UI.Hunch();\r\n}\r\n```\r\n\r\n**Expected behavior:**\r\nThe value `new UI.Hunch()` is assignable to the return type reference `UI.Hunch`.\r\n\r\n**Actual behavior:**\r\nError: Hunch is not assignable to `{ item: () => void } & { item: () => void }`\r\n\r\nLooks like `Provider`s prototype assignment confuses the type reference to UI.Hunch.\r\n\r\nDiscovered in chrome-devtools-frontend, but it's been this way for a long time. Not a recent regression.","author":{"url":"https://github.com/sandersn","@type":"Person","name":"sandersn"},"datePublished":"2018-09-17T16:59:26Z","url":"https://github.com/microsoft/TypeScript/issues/27146"}
| 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:303f311e-71f6-92f1-4de2-c4f323ac86a9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8716:21BD98:26971E9:31014A2:6B01CA8B |
| html-safe-nonce | 5b157b4868da19cb182ad82b5a19078aed0d140cc788091d102596339cf0de9e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzE2OjIxQkQ5ODoyNjk3MUU5OjMxMDE0QTI6NkIwMUNBOEIiLCJ2aXNpdG9yX2lkIjoiODk0NzY5MDYzNzgxNDI1NDIxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 35b0f16dafe1fd8008d1bd655df314efc5e2ab2369b1b8c8fe7524717081c343 |
| hovercard-subject-tag | issue:360958217 |
| 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/27146/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8ea9eb2258fb3e7911e8a46447d9b5ecdbddeaf86ba826e60c5392f500a2e937/microsoft/TypeScript/issues/27146 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8ea9eb2258fb3e7911e8a46447d9b5ecdbddeaf86ba826e60c5392f500a2e937/microsoft/TypeScript/issues/27146 |
| og:image:alt | var UI = {} UI.Hunch = class { constructor() { } } UI.Hunch.Provider = function() {}; UI.Hunch.Provider.prototype = { /** * @return {void} */ item() {} }; /** * @returns {UI.Hunch} */ function fail... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sandersn |
| 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