Skip to content

Mixins Overrides Drop DocumentationΒ #60871

Open
@LukeAbby

Description

@LukeAbby

πŸ”Ž Search Terms

mixins overrides, documentation dropped

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about documentation, mixins, etc.

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.7.2#code/CYUwxgNghgTiAEkoGdnwEIpAYWq+A3gFDynwD0AVJfMgPYC2CwdYArkwHYAuU3AlnU7xK5EmWS8BYeE24ALOsAAUASgBc8ThwBGIGAG4iAXyJFuATwAOCAIKcL2IZJhsw3OjHgBeeFB0uUO5aIADu8MoAdNGwAObImlAOANoAuqo+AHzwdDoAVuDcZgBmbJzugsIAsvwAHgA8ACrwILXcIJzAaPaOztyu7p6ZypjIOHgJ8I0ZxKT+gcFI+DW1-Jy4KGit7Z1oo+ObhOKkYH0DHjBRMTDxiSnpR2QSbDaX0ZFxyKpGT6akpuI4Nw2DBqnU1htUEYAeRyPAAPJeBieBDIfgMKwQCzwCx0NiIJLwUIwfjtdREWGICbwFYQ6kEUyU0BIODwUrlARCGl1JotNodLrwHpOTguNwXYb7SGTaaaSw2OjFbmrdbUgBkUyMRGZ0FZSzQKxAwD5O0FKxGWGlM3Ekj4-BkckUKg0Wl0+mhZkNwEijqURkpZAAevAAHJ0eAsdhcKSVSJAA

πŸ’» Code

declare class BaseClass {
    /** some documentation */
    static method(): number;
}

type AnyConstructor = abstract new (...args: any[]) => object

function Mix<T extends AnyConstructor>(BaseClass: T) {
  abstract class MixinClass extends BaseClass {
    constructor(...args: any[]) {
      super(...args);
    }
  }

  return MixinClass;
}

// Or more simply you can write:
class MixinClass {}
declare function Mix<T extends AnyConstructor>(BaseClass: T): typeof MixinClass & T;

declare class Mixed extends Mix(BaseClass) {
  static method(): number;
}

Mixed.method;
//    ^ No documentation.

πŸ™ Actual behavior

Overrides of a mixin class does not have documentation.

Notably if you don't override the method the documentation does show up. This shows it's possible to get it.

πŸ™‚ Expected behavior

It should inherit documentation.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedYou can do thisPossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions