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

Consolidate naming for Mixin instance type #5374

Closed
tephenavies opened this issue Mar 29, 2021 · 2 comments
Closed

Consolidate naming for Mixin instance type #5374

tephenavies opened this issue Mar 29, 2021 · 2 comments
Assignees

Comments

@tephenavies
Copy link
Member

At the moment we have about 90% of Mixins using XMixin.XMixin:

namespace TableMixin {
  export interface TableMixin
    extends InstanceType<ReturnType<typeof TableMixin>> {}
  export function isMixedInto(model: any): model is TableMixin {
    return model && model.hasTableMixin;
  }
}

and 10% using XMixin.Instance:

namespace TileErrorHandlerMixin {
  export interface Instance
    extends InstanceType<ReturnType<typeof TileErrorHandlerMixin>> {}
  export function isMixedInto(model: any): model is Instance {
    return model?.hasTileErrorHandlerMixin;
  }
}

Note that removing the mixin name from the instance type name shouldn't make IDE types worse as the namespace is still displayed:
image

We should decide on a naming scheme, document it and apply it universally. I prefer XMixin.Instance because it's more descriptive. It's the instance type of XMixin

@tephenavies tephenavies added the Version 8 formerly MobX label Mar 29, 2021
@nf-s
Copy link
Contributor

nf-s commented Mar 29, 2021

I like XMixin.Instance over XMixin.XMixin

@nf-s
Copy link
Contributor

nf-s commented Jul 22, 2021

Closed by #5661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants