Skip to content

Proposal to remove inheritance of static properties #613

Closed
@rjamesnw

Description

@rjamesnw

Moving over from here: https://typescript.codeplex.com/workitem/2047

I think this may warrant more discussion. I believe there should be some way to FORCIBLY allow a derived static function with completely different parameter types to be implemented. What if I want to have {TypeA}.create(x:number) and later {TypeB}.create(s:string) (where TypeB extends TypeA)? Well, for derived types with special parameters, it fails because the signature must match. :/ Derived type constructors are not bound by the same rules! This is a bad system when trying to implement type factories (for example, object pools for game development), and also prevents end users from extending types in the same manner as constructors. Again, constructors of derived types are NOT limited in the same way.

I propose to allow the addition of "new" (like in C#) to allow forcing new function signatures, since anyone who does obviously knows what they're doing, and shouldn't have their "hands held" in such manner. I'm aware that ES6 supports static side inheritance, but I'm sure it still allows developers to create overriding signatures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions