Title: Contextually type object assignments to inherited member · Issue #5181 · microsoft/TypeScript · GitHub
Open Graph Title: Contextually type object assignments to inherited member · Issue #5181 · microsoft/TypeScript
X Title: Contextually type object assignments to inherited member · Issue #5181 · microsoft/TypeScript
Description: I think the following should compile with no error: declare module Backbone { interface RoutesHash { [routePattern: string]: string | {(...urlParts: string[]): void}; } class Events { } class Router extends Events { routes: RoutesHash; }...
Open Graph Description: I think the following should compile with no error: declare module Backbone { interface RoutesHash { [routePattern: string]: string | {(...urlParts: string[]): void}; } class Events { } class Route...
X Description: I think the following should compile with no error: declare module Backbone { interface RoutesHash { [routePattern: string]: string | {(...urlParts: string[]): void}; } class Events { } class Route...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/5181
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Contextually type object assignments to inherited member","articleBody":"I think the following should compile with no error:\n\n``` typescript\ndeclare module Backbone {\n interface RoutesHash {\n [routePattern: string]: string | {(...urlParts: string[]): void};\n }\n class Events { }\n class Router extends Events {\n routes: RoutesHash;\n }\n}\n\ndeclare module Marionette {\n class AppRouter extends Backbone.Router {\n }\n}\n\nmodule Backbone.Tests {\n // Error, routes is not contextually typed\n class MyRouter extends Backbone.Router {\n routes = {\n \"some/route\": \"someMethod\",\n \"some/otherRoute\": () => {}\n };\n }\n}\n\nmodule Marionette.Tests {\n // Error, routes is not contextually typed\n class MyRouter extends Marionette.AppRouter {\n routes = {\n \"some/route\": \"someMethod\",\n \"some/otherRoute\": () => {}\n };\n }\n}\n```\n","author":{"url":"https://github.com/omidkrad","@type":"Person","name":"omidkrad"},"datePublished":"2015-10-08T19:15:16Z","url":"https://github.com/microsoft/TypeScript/issues/5181"}
| 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:5aaf3c37-b6e9-3645-8600-fdb033d10120 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A8F6:2E124E:F4763C:138278D:6B011202 |
| html-safe-nonce | 90212ccf964c2af53f007c0d547b56b1c2b736775c9104643e76f7fa8f2e6b3b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOEY2OjJFMTI0RTpGNDc2M0M6MTM4Mjc4RDo2QjAxMTIwMiIsInZpc2l0b3JfaWQiOiI1NjI4NzUzNDc4NzE0MjAwNTc4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2fceaef366ab1e56d9ae075c9a5354cdd061f8f5c4ac4353651fe756f21e0942 |
| hovercard-subject-tag | issue:110522690 |
| 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/5181/issue_layout |
| twitter:image | https://opengraph.githubassets.com/603ee88eedac3dafb50f8fa837476aa67f69431d22cf396b2aa353e2b9bd4ef3/microsoft/TypeScript/issues/5181 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/603ee88eedac3dafb50f8fa837476aa67f69431d22cf396b2aa353e2b9bd4ef3/microsoft/TypeScript/issues/5181 |
| og:image:alt | I think the following should compile with no error: declare module Backbone { interface RoutesHash { [routePattern: string]: string | {(...urlParts: string[]): void}; } class Events { } class Route... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | omidkrad |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width