Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define collection types as extending a Collection interface #84

Open
zspitz opened this issue Jan 28, 2018 · 0 comments
Open

Define collection types as extending a Collection interface #84

zspitz opened this issue Jan 28, 2018 · 0 comments

Comments

@zspitz
Copy link
Owner

zspitz commented Jan 28, 2018

e.g.

declare namespace Word {
    class GroupShapes {
        private 'Word.GroupShapes_typekey': GroupShapes;
        private constructor();
        readonly Application: Application;
        readonly Count: number;
        readonly Creator: number;
        Item(Index: any): Shape;
        readonly Parent: any;
        Range(Index: any): ShapeRange;
    }
}

could be defined as:

declare class CollectionBase<TItem, TKey = number> {
    readonly Count: number;
    Item(Index: TKey): TItem;
}

declare namespace Word {
    class Shape {
        private 'Word.Shape_typekey': Shape;
        private constructor();
    }

    class GroupShapes extends CollectionBase<Shape, any> {
        private 'Word.GroupShapes_typekey': GroupShapes;
        private constructor();
        readonly Creator: number;
        readonly Parent: any;
    }
}

Playground

Check first that the class has all the members of the Collection class.

@zspitz zspitz changed the title Define collection types as extending an ICollection interface Define collection types as extending a Collection interface Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant