Skip to content

Commit

Permalink
fix(hook): 添加一个基础的props参数限制
Browse files Browse the repository at this point in the history
  • Loading branch information
HammCn committed Sep 4, 2023
1 parent a6beaa6 commit 9247521
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions hook/useAirDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AirEntity } from '../base/AirEntity'
import { ClassConstructor } from '../type/ClassConstructor'
import { AirAbstractEntityService } from '../base/AirAbstractEntityService'
import { AirClassTransformer } from '../helper/AirClassTransformer'
import { IJson } from '../interface/IJson'

/**
* # 引入详情的Hook
Expand All @@ -13,8 +14,7 @@ import { AirClassTransformer } from '../helper/AirClassTransformer'
* @param serviceClass 详情使用的Service
* @param option [可选]更多的配置
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function useAirDetail<E extends AirEntity>(props: any, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<AirAbstractEntityService<E>>, option: IUseDetailOption<E> = {}): IUseDetailResult<E> {
export function useAirDetail<E extends AirEntity>(props: IJson, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<AirAbstractEntityService<E>>, option: IUseDetailOption<E> = {}): IUseDetailResult<E> {
const isLoading = ref(false)

const service = AirClassTransformer.newInstance(serviceClass)
Expand Down
4 changes: 2 additions & 2 deletions hook/useAirEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { AirEntity } from '../base/AirEntity'
import { IUseEditorOption } from '../interface/IUseEditorOption'
import { IUseEditorResult } from '../interface/IUseEditorResult'
import { useAirDetail } from './useAirDetail'
import { IJson } from '../interface/IJson'

/**
* # 引入Editor的Hook
Expand All @@ -15,8 +16,7 @@ import { useAirDetail } from './useAirDetail'
* @param serviceClass Editor使用的Service
* @param option [可选]更多的配置
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function useAirEditor<E extends AirEntity>(props: any, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<AirAbstractEntityService<E>>, option: IUseEditorOption<E> = {}): IUseEditorResult<E> {
export function useAirEditor<E extends AirEntity>(props: IJson, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<AirAbstractEntityService<E>>, option: IUseEditorOption<E> = {}): IUseEditorResult<E> {
const result = useAirDetail(props, entityClass, serviceClass, option)

const rules = result.service.createValidator(props.param, option.customRules || {})
Expand Down
4 changes: 2 additions & 2 deletions hook/useAirSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AirSort } from '../model/AirSort'
import { AirPage } from '../model/AirPage'
import { IUseSelectorOption } from '../interface/IUseSelectorOption'
import { IUseSelectorResult } from '../interface/IUseSelectorResult'
import { IJson } from '../interface/IJson'

/**
* # 引入Selector使用的Hook
Expand All @@ -17,8 +18,7 @@ import { IUseSelectorResult } from '../interface/IUseSelectorResult'
* @param serviceClass Selector使用的Service类
* @param option [可选] 更多配置
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function useAirSelector<E extends AirEntity>(props: any, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<AirAbstractEntityService<E>>, option: IUseSelectorOption<E> = {}): IUseSelectorResult<E> {
export function useAirSelector<E extends AirEntity>(props: IJson, entityClass: ClassConstructor<E>, serviceClass: ClassConstructor<AirAbstractEntityService<E>>, option: IUseSelectorOption<E> = {}): IUseSelectorResult<E> {
const isLoading = ref(false)

const selected = ref(props.selectList)
Expand Down

0 comments on commit 9247521

Please sign in to comment.