Skip to content

Feature request: Support constructor extension class decorator #537

Description

@thatcosmonaut
export function Reads(...message_type_args: Type<Message>[]) {
    return <T extends new(...args: any[]) => {}>(constructor: T) => {
        return class extends constructor {
            protected read_message_types = new Set<Type<Message>>(message_type_args);
        };
    };
}

@Reads(AMessage)
class AMessageReaderEngine extends Engine {}

I am using the following decorator pattern in my framework. It would be really nice if I could support it on the Lua side instead of having to declare the properties directly in the class, I find this much more readable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions