Our blazing fast Grid component built with pure JavaScript


Post by henrique »

I don't know much about TypeScript, and I need help with the definition file. In the last version was added this definition:

type AnyConstructor<A = any> = new (...input: any[]) => A

Can someone explain to me what this does?


Post by henrique »

I need help in this piece of source:

export const StoreCRUD : <T extends AnyConstructor<Base>>(base : T) => AnyConstructor<InstanceType<T> & StoreCRUDClass>

Post by nickolay »

AnyConstructor as the type suggest is a function, that can be used with the new keyword - a class constructor. A class instantiates into the A type.

StoreCRUD is a mixin - a function, which, when called with the 1st argument being a class constructor (class extends the Base), returns a class constructor, which is a subclass of the 1st argument with the StoreCRUDClass definitions added.

See this blog post for more details: https://www.bryntum.com/blog/the-mixin-pattern-in-typescript-all-you-need-to-know/


Post by henrique »

Thanks for the reply!


Post Reply