微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在对象内部记录方法,这些对象是Better-docs中的类的属性

如何解决在对象内部记录方法,这些对象是Better-docs中的类的属性

我有一个Vuex模块工厂,它具有一些认的突变和动作。我想使用更好的文档来记录这些内容,这些文档使用JSDoc语法。但是,我只能记录在突变对象中的方法,而这是CustomModule类的一个属性

我尝试使用this的方式,但是它对我不起作用。

这是示例代码

/**
 *
 * A generic class to create custom Vuex module
 * @export
 * @abstract
 * @class CustomModule
 * @category Generic Store
 * @template Entity Entity used in state
 * @property {Repository} repository Generic class for handling requests
 * @property {object} mutations Contains all Vuex mutations
 */
export abstract class CustomModule<Entity extends EntityBasee> = {}> {

  /**
   * Mutations
   * @memberof CustomModule
   * @alias Mutations
   */
  mutations = {
    // I want to document these methods to be something like that CustomModule.mutations.assignItems
    assignItems: (state: ModuleState<Entity>,value: Entity[]) => {
      state.items = value;
    },selectItem: (state: ModuleState<Entity>,value: Entity) => {
      state.selectedItem = value;
    },setIsLoading: (state: ModuleState<Entity>,value: boolean) => {
      state.isLoading = value;
    },setError: (state: ModuleState<Entity>,value: string) => {
      state.error = value;
    }
  };
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。