在对象内部记录方法,这些对象是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 (将#修改为@)