镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Contextually type object assignments to inherited member #5181

Description

@omidkrad

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;
    }
}

declare module Marionette {
    class AppRouter extends Backbone.Router {
    }
}

module Backbone.Tests {
    // Error, routes is not contextually typed
    class MyRouter extends Backbone.Router {
        routes = {
            "some/route": "someMethod",
            "some/otherRoute": () => {}
        };
    }
}

module Marionette.Tests {
    // Error, routes is not contextually typed
    class MyRouter extends Marionette.AppRouter {
        routes = {
            "some/route": "someMethod",
            "some/otherRoute": () => {}
        };
    }
}

Activity

  1. DanielRosenwasser commented on Oct 8, 2015

    @DanielRosenwasser
    Member

    Duplicate of #3667?

  2. changed the title [-]Feature request: Contextually type object assignments to inherited members[/-] [+]Contextually type object assignments to inherited member[/+] on Oct 8, 2015
  3. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions