Skip to content

Decorators within mixins #14607

Closed
Closed
@eb2501

Description

@eb2501

I wonder if there's any plans to support decorators within mixins?

  type Constructor<T> = { new (...args: any[]): T }

  function Mixin<T extends Constructor<{}>>(Base : T) {
    return class extends Base {
      constructor(...args: any[]) {
        super(...args)
      }

      @decorator
      get y() {
        return this.x + 3
      }
  }

TSC 2.2.1 currently rejects this construction: [Decorators are not valid here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions