Skip to content

Commit 5c9f6ca

Browse files
committed
fix: use optional keys instead of new type
1 parent 5549466 commit 5c9f6ca

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/runtime/query/match/pipeline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { QueryBuilderParams, QueryBuilderSchema, QueryPipe } from '../../types'
1+
import type { QueryBuilderParams, QueryPipe } from '../../types'
22
import { apply, ensureArray, sortList, withoutKeys, withKeys } from './utils'
33
import { createMatch } from '.'
44

@@ -9,7 +9,7 @@ export function createPipelineFetcher<T> (getContentsList: () => Promise<T[]>) {
99
/**
1010
* Exctract surrounded items of specific condition
1111
*/
12-
const surround = (data: any[], { query, before, after }: QueryBuilderSchema['surround']) => {
12+
const surround = (data: any[], { query, before, after }: QueryBuilderParams['surround']) => {
1313
const matchQuery = typeof query === 'string' ? { _path: query } : query
1414
// Find matched item index
1515
const index = data.findIndex(item => match(item, matchQuery))

src/runtime/types.d.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,15 @@ export interface SortFields {
153153

154154
export type SortOptions = SortParams | SortFields
155155

156-
export interface QueryBuilderSchema {
157-
first: boolean
158-
skip: number
159-
limit: number
160-
only: string[]
161-
without: string[]
162-
sort: SortOptions[]
163-
where: object[]
164-
surround: {
156+
export interface QueryBuilderParams {
157+
first?: boolean
158+
skip?: number
159+
limit?: number
160+
only?: string[]
161+
without?: string[]
162+
sort?: SortOptions[]
163+
where?: object[]
164+
surround?: {
165165
query: string | object
166166
before?: number
167167
after?: number
@@ -170,8 +170,6 @@ export interface QueryBuilderSchema {
170170
[key: string]: any
171171
}
172172

173-
export type QueryBuilderParams = Partial<QueryBuilderSchema>
174-
175173
export interface QueryBuilder<T = ParsedContentMeta> {
176174
/**
177175
* Select a subset of fields

0 commit comments

Comments
 (0)