Skip to content

Proposal : rest instance variables #6502

Closed
@xmehaut

Description

@xmehaut

In order to implement in a simple manner mixins, it could be interesting to provide a kind of rest mechanism for instances variables (and methods).

Imagine the following syntax :

     class OtherClass {
           dummy1 : string;
           dummy2 : number;
           dummy() {
            }
     }
     class MyGenericClass <aClass> {
           ...: aClass;
     }
     class MyTerminalClass extends MyGenericClass<OtherClass> {
            aMethod() {
                  let toto = this.dummy1;
                  let titi = this.dummy2;
                  this.dummy();
            }
     }

This could be a nice way to define and use mixins...

We may also combine mixins like this :

      ... : OtherClass & OtherOtherClass ;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs ProposalThis issue needs a plan that clarifies the finer details of how it could be implemented.SuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions