Skip to content

Commit

Permalink
fix(types): add const type parameter for QueryBuilder.only() and .wit…
Browse files Browse the repository at this point in the history
…hout() (#2573)
  • Loading branch information
thunfisch987 committed Feb 29, 2024
1 parent a0ab377 commit 8f560c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/runtime/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,14 @@ export interface QueryBuilder<T = ParsedContentMeta> {
/**
* Select a subset of fields
*/
only<K extends keyof T>(keys: K): QueryBuilder<Pick<T, K>>
only<K extends (keyof T)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>
only<const K extends keyof T>(keys: K): QueryBuilder<Pick<T, K>>
only<const K extends (keyof T)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>

/**
* Remove a subset of fields
*/
without<K extends keyof T | string>(keys: K): QueryBuilder<Omit<T, K>>
without<K extends (keyof T | string)[]>(keys: K): QueryBuilder<Omit<T, K[number]>>
without<const K extends keyof T | string>(keys: K): QueryBuilder<Omit<T, K>>
without<const K extends (keyof T | string)[]>(keys: K): QueryBuilder<Omit<T, K[number]>>

/**
* Sort results
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/types/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ export interface ContentQueryBuilder<T = ParsedContentMeta, Y = {}> {
/**
* Remove a subset of fields
*/
without<K extends keyof T | string>(keys: K): ContentQueryBuilder<Omit<T, K>, Y>
without<K extends (keyof T | string)[]>(keys: K): ContentQueryBuilder<Omit<T, K[number]>, Y>
without<const K extends keyof T | string>(keys: K): ContentQueryBuilder<Omit<T, K>, Y>
without<const K extends (keyof T | string)[]>(keys: K): ContentQueryBuilder<Omit<T, K[number]>, Y>

/**
* Filter results
Expand Down

0 comments on commit 8f560c6

Please sign in to comment.