Skip to content

Commit

Permalink
fix(plugin-docsearch): fix broken types, close #296
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 7, 2024
1 parent e9f0186 commit 9b5f904
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 233 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"prettier": "^3.4.2",
"prettier-config-vuepress": "^5.0.0",
"rimraf": "^6.0.1",
"rollup": "^4.28.0",
"rollup": "^4.28.1",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-resolve-shebang": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion plugins/pwa/plugin-pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"access": "public"
},
"devDependencies": {
"rollup": "^4.28.0"
"rollup": "^4.28.1"
}
}
1 change: 1 addition & 0 deletions plugins/search/plugin-docsearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"dependencies": {
"@docsearch/css": "^3.8.0",
"@docsearch/js": "^3.8.0",
"@docsearch/react": "^3.8.0",
"@vuepress/helper": "workspace:*",
"@vueuse/core": "^12.0.0",
"ts-debounce": "^4.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { DocSearchProps } from '@docsearch/react'
import { debounce } from 'ts-debounce'
import { useRouter } from 'vuepress/client'
import { removeLeadingSlash, resolveRoutePathFromUrl } from 'vuepress/shared'
import type { DocSearchProps } from '../../shared/index.js'

declare const __DOCSEARCH_INDEX_BASE__: string

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { DocSearchProps } from '@docsearch/react'
import { deepAssign, isFunction } from '@vuepress/helper/client'
import type { App, ComputedRef, InjectionKey, MaybeRefOrGetter, Ref } from 'vue'
import { computed, inject, isRef, ref, watch } from 'vue'
import { useRouteLocale } from 'vuepress/client'
import type { DocSearchOptions, DocSearchProps } from '../../shared/index.js'
import type { DocSearchOptions } from '../../shared/index.js'

declare const __VUEPRESS_DEV__: boolean
declare const __DOCSEARCH_OPTIONS__: DocSearchOptions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DocSearchProps } from '../../shared/index.js'
import type { DocSearchProps } from '@docsearch/react'

type DocSearchTranslation = Exclude<DocSearchProps['translations'], undefined>

Expand Down
8 changes: 1 addition & 7 deletions plugins/search/plugin-docsearch/src/shared/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import type docsearch from '@docsearch/js'
import type { DocSearchProps } from '@docsearch/react'
import type { LocaleConfig } from 'vuepress/shared'

export type DocSearchProps = typeof docsearch extends (
options: infer T,
) => unknown
? T
: never

export type DocSearchLocaleOptions = Partial<
Pick<
DocSearchProps,
Expand Down
Loading

0 comments on commit 9b5f904

Please sign in to comment.