Skip to content

Mixins Overrides Drop Documentation #2188

@LukeAbby

Description

@LukeAbby

Note: This is a refiling of microsoft/TypeScript#60871 in accordance to the instructions to follow after being closed in microsoft/TypeScript#62827.

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions