Skip to content

Commit

Permalink
fix: remove d.ts (#2427)
Browse files Browse the repository at this point in the history

Co-authored-by: Farnabaz <farnabaz@gmail.com>
  • Loading branch information
Barbapapazes and farnabaz authored Dec 12, 2023
1 parent f76ed94 commit 7ed3b07
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
74 changes: 37 additions & 37 deletions src/runtime/types/index.d.ts → src/runtime/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { LayoutKey } from '#build/types/layouts'
import type { Theme } from 'shiki-es'
import type { StorageValue } from 'unstorage'
import type { LayoutKey } from '#build/types/layouts'

export interface ParsedContentInternalMeta {
/**
Expand Down Expand Up @@ -45,27 +44,22 @@ export interface ParsedContentInternalMeta {
_extension?: 'md' | 'yaml' | 'yml' | 'json' | 'json5' | 'csv'
}

export interface ParsedContentMeta extends ParsedContentInternalMeta {
/**
* Layout
*/
layout?: LayoutKey
//

[key: string]: any
export interface TocLink {
id: string
text: string
depth: number
children?: TocLink[]
}

export interface ParsedContent extends ParsedContentMeta {
/**
* Excerpt
*/
excerpt?: MarkdownRoot
/**
* Content body
*/
body: MarkdownRoot | null
export interface Toc {
title: string
depth: number
searchDepth: number
links: TocLink[]
}

//
export interface MarkdownNode {
type: string
tag?: string
Expand All @@ -78,18 +72,18 @@ export interface MarkdownNode {
fmAttributes?: Record<string, any>
}

export interface MarkdownHtmlNode extends MarkdownNode {
type: 'html'
value: string
}

export interface MarkdownRoot {
type: 'root'
children: MarkdownNode[]
props?: Record<string, any>
toc?: Toc
}

export interface MarkdownHtmlNode extends MarkdownNode {
type: 'html'
value: string
}

export interface MarkdownPlugin extends Record<string, any> {}

export interface MarkdownOptions {
Expand All @@ -109,18 +103,24 @@ export interface MarkdownOptions {
rehypePlugins: Record<string, false | (MarkdownPlugin & { instance: any })>
}

export interface TocLink {
id: string
text: string
depth: number
children?: TocLink[]
export interface ParsedContentMeta extends ParsedContentInternalMeta {
/**
* Layout
*/
layout?: LayoutKey

[key: string]: any
}

export interface Toc {
title: string
depth: number
searchDepth: number
links: TocLink[]
export interface ParsedContent extends ParsedContentMeta {
/**
* Excerpt
*/
excerpt?: MarkdownRoot
/**
* Content body
*/
body: MarkdownRoot | null
}

export interface MarkdownParsedContent extends ParsedContent {
Expand Down Expand Up @@ -413,7 +413,7 @@ export interface QueryBuilderWhere extends Partial<Record<keyof ParsedContentInt
**/
$in?: string | Array<string | number | boolean>

[key: string]: string | number | boolean | RegExp | QueryBuilderWhere | Array<string | number | boolean | QueryBuilderWhere>
[key: string]: undefined | string | number | boolean | RegExp | QueryBuilderWhere | Array<string | number | boolean | QueryBuilderWhere>
}

export interface QueryBuilderParams {
Expand All @@ -437,8 +437,8 @@ export interface QueryBuilder<T = ParsedContentMeta> {
/**
* Select a subset of fields
*/
only<K extends keyof T | string>(keys: K): QueryBuilder<Pick<T, K>>
only<K extends (keyof T | string)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>
only<K extends keyof T>(keys: K): QueryBuilder<Pick<T, K>>
only<K extends (keyof T)[]>(keys: K): QueryBuilder<Pick<T, K[number]>>

/**
* Remove a subset of fields
Expand Down Expand Up @@ -495,7 +495,7 @@ export interface QueryBuilder<T = ParsedContentMeta> {
* Retrieve query builder params
* @internal
*/
params: () => readonly QueryBuilderParams
params: () => QueryBuilderParams
}

export type QueryPipe<T = any> = (data: Array<T>, param: QueryBuilderParams) => Array<T> | void
Expand Down
2 changes: 0 additions & 2 deletions src/runtime/types/query.d.ts → src/runtime/types/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,4 @@ export interface ContentQueryBuilder<T = ParsedContentMeta, Y = {}> {
withDirConfig(): ContentQueryBuilder<T, ContentQueryWithDirConfig>
}


export type ContentQueryFetcher<T> = (query: ContentQueryBuilder<T>) => Promise<ContentQueryResponse>

0 comments on commit 7ed3b07

Please # to comment.