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

usePagination 类型定义不严谨 #57

Open
I-Want-ToBelieve opened this issue Apr 22, 2021 · 0 comments
Open

usePagination 类型定义不严谨 #57

I-Want-ToBelieve opened this issue Apr 22, 2021 · 0 comments

Comments

@I-Want-ToBelieve
Copy link

I-Want-ToBelieve commented Apr 22, 2021

当 run 有形参时, 通过泛型给定形参类型,此时 usePagination 第一个参数类型推倒不与实参类型兼容
并且类型 Params 也未导出,归根结底是类型 Params 不与接口分页 PagingParams 类型兼容

  const { paging, runChangePaging, run } = usePagination<
    Params & { sku_id: string }
  >(store.getAllBatchBySkuId as any, {
    paginationKey: 'ProductDetailsModal',
    defaultPaging: {
      need_count: true,
    },
  })
export interface PagingParams {
  offset?: number
  sequence?: string
  all?: boolean
  limit: number
  need_count?: boolean
}


interface Params {
  paging?: PagingReq
}


// 用于请求
interface PagingReq {
  offset?: number
  /** 默认 10 */
  limit?: number
  /** 默认 false */
  need_count?: boolean
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant