Skip to content

Commit

Permalink
fix(types): use import type for DefaultTheme
Browse files Browse the repository at this point in the history
  • Loading branch information
brc-dd committed Jun 17, 2022
1 parent 42813ce commit 7a7fb39
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 26 deletions.
9 changes: 0 additions & 9 deletions src/client/shim.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,3 @@ declare module '@docsearch/js' {
function docsearch<T = any>(props: T): void
export default docsearch
}

declare module '@docsearch/react/dist/esm/types' {
export type DocSearchHit = any
}

declare module '@docsearch/css' {
const css: string
export default css
}
7 changes: 3 additions & 4 deletions src/client/theme-default/components/VPAlgoliaSearchBox.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script setup lang="ts">
import type { DefaultTheme } from 'vitepress/theme'
import docsearch from '@docsearch/js'
import { DocSearchHit } from '@docsearch/react/dist/esm/types'
import { onMounted } from 'vue'
import { useRouter, useRoute, useData } from 'vitepress'
import { DefaultTheme } from '../config'
const router = useRouter()
const route = useRoute()
Expand Down Expand Up @@ -52,15 +51,15 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
}
},
transformItems(items: DocSearchHit[]) {
transformItems(items: any[]) {
return items.map((item) => {
return Object.assign({}, item, {
url: getRelativePath(item.url)
})
})
},
hitComponent({ hit, children }: { hit: DocSearchHit, children: any }) {
hitComponent({ hit, children }: { hit: any; children: any }) {
const relativeHit = hit.url.startsWith('http')
? getRelativePath(hit.url as string)
: hit.url
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPNavBarMenuGroup.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { DefaultTheme } from '../config'
import type { DefaultTheme } from 'vitepress/theme'
import VPFlyout from './VPFlyout.vue'
defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPNavBarMenuLink.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { useData } from 'vitepress'
import { isActive } from '../support/utils'
import { DefaultTheme } from '../config'
import VPLink from './VPLink.vue'
defineProps<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { DefaultTheme } from '../config'
import type { DefaultTheme } from 'vitepress/theme'
import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue'
defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPSidebarGroup.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { ref } from 'vue'
import { DefaultTheme } from '../config'
import VPIconPlusSquare from './icons/VPIconPlusSquare.vue'
import VPIconMinusSquare from './icons/VPIconMinusSquare.vue'
import VPSidebarLink from './VPSidebarLink.vue'
Expand Down
4 changes: 2 additions & 2 deletions src/client/theme-default/components/VPSidebarLink.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { inject } from 'vue'
import { useData } from 'vitepress'
import { DefaultTheme } from '../config'
import { isActive, normalizeLink } from '../support/utils'
import { isActive } from '../support/utils'
import VPLink from './VPLink.vue'
defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPSocialLink.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { DefaultTheme } from '../config'
import type { DefaultTheme } from 'vitepress/theme'
import VPIconDiscord from './icons/VPIconDiscord.vue'
import VPIconFacebook from './icons/VPIconFacebook.vue'
import VPIconGitHub from './icons/VPIconGitHub.vue'
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/components/VPSocialLinks.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { DefaultTheme } from '../config'
import type { DefaultTheme } from 'vitepress/theme'
import VPSocialLink from './VPSocialLink.vue'
defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/composables/nav.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { DefaultTheme } from 'vitepress/theme'
import { ref, computed } from 'vue'
import { useData, useRoute } from 'vitepress'
import type { DefaultTheme } from '../config'

export function useNav() {
const isScreenOpen = ref(false)
Expand Down
1 change: 0 additions & 1 deletion src/client/theme-default/config.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/client/theme-default/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { Theme } from 'vitepress'
import Layout from './Layout.vue'
import NotFound from './NotFound.vue'

export { DefaultTheme } from './config'

export { default as VPHomeHero } from './components/VPHomeHero.vue'
export { default as VPHomeFeatures } from './components/VPHomeFeatures.vue'
export { default as VPHomeSponsors } from './components/VPHomeSponsors.vue'
Expand Down
2 changes: 1 addition & 1 deletion src/client/theme-default/support/sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DefaultTheme } from '../config'
import type { DefaultTheme } from 'vitepress/theme'
import { ensureStartingSlash } from './utils'

/**
Expand Down

0 comments on commit 7a7fb39

Please sign in to comment.