Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixins Overrides Drop Documentation #60871

Open
LukeAbby opened this issue Dec 29, 2024 · 0 comments Β· May be fixed by #60873
Open

Mixins Overrides Drop Documentation #60871

LukeAbby opened this issue Dec 29, 2024 · 0 comments Β· May be fixed by #60873
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone

Comments

@LukeAbby
Copy link

πŸ”Ž 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 that it'

πŸ™‚ Expected behavior

It should inherit documentation.

Additional information about the issue

No response

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases labels Jan 3, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted You can do this Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Projects
None yet
2 participants