fix(types): use `import type` for `DefaultTheme` (#804)

pull/811/head
Divyansh Singh 2 years ago committed by GitHub
parent 42813ce936
commit 107724ac6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,12 +20,3 @@ declare module '@docsearch/js' {
function docsearch<T = any>(props: T): void function docsearch<T = any>(props: T): void
export default docsearch export default docsearch
} }
declare module '@docsearch/react/dist/esm/types' {
export type DocSearchHit = any
}
declare module '@docsearch/css' {
const css: string
export default css
}

@ -1,9 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { DefaultTheme } from 'vitepress/theme'
import docsearch from '@docsearch/js' import docsearch from '@docsearch/js'
import { DocSearchHit } from '@docsearch/react/dist/esm/types'
import { onMounted } from 'vue' import { onMounted } from 'vue'
import { useRouter, useRoute, useData } from 'vitepress' import { useRouter, useRoute, useData } from 'vitepress'
import { DefaultTheme } from '../config'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@ -52,7 +51,7 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
} }
}, },
transformItems(items: DocSearchHit[]) { transformItems(items: any[]) {
return items.map((item) => { return items.map((item) => {
return Object.assign({}, item, { return Object.assign({}, item, {
url: getRelativePath(item.url) url: getRelativePath(item.url)
@ -60,7 +59,7 @@ function initialize(userOptions: DefaultTheme.AlgoliaSearchOptions) {
}) })
}, },
hitComponent({ hit, children }: { hit: DocSearchHit, children: any }) { hitComponent({ hit, children }: { hit: any; children: any }) {
const relativeHit = hit.url.startsWith('http') const relativeHit = hit.url.startsWith('http')
? getRelativePath(hit.url as string) ? getRelativePath(hit.url as string)
: hit.url : hit.url

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { withBase } from 'vitepress'
import type { DefaultTheme } from 'vitepress/theme' import type { DefaultTheme } from 'vitepress/theme'
import { withBase } from 'vitepress'
defineProps<{ defineProps<{
image: DefaultTheme.ThemeableImage image: DefaultTheme.ThemeableImage

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { DefaultTheme } from '../config' import type { DefaultTheme } from 'vitepress/theme'
import VPFlyout from './VPFlyout.vue' import VPFlyout from './VPFlyout.vue'
defineProps<{ defineProps<{

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { useData } from 'vitepress' import { useData } from 'vitepress'
import { isActive } from '../support/utils' import { isActive } from '../support/utils'
import { DefaultTheme } from '../config'
import VPLink from './VPLink.vue' import VPLink from './VPLink.vue'
defineProps<{ defineProps<{

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { DefaultTheme } from '../config' import type { DefaultTheme } from 'vitepress/theme'
import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue' import VPNavScreenMenuGroupLink from './VPNavScreenMenuGroupLink.vue'
defineProps<{ defineProps<{

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { ref } from 'vue' import { ref } from 'vue'
import { DefaultTheme } from '../config'
import VPIconPlusSquare from './icons/VPIconPlusSquare.vue' import VPIconPlusSquare from './icons/VPIconPlusSquare.vue'
import VPIconMinusSquare from './icons/VPIconMinusSquare.vue' import VPIconMinusSquare from './icons/VPIconMinusSquare.vue'
import VPSidebarLink from './VPSidebarLink.vue' import VPSidebarLink from './VPSidebarLink.vue'

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { inject } from 'vue' import { inject } from 'vue'
import { useData } from 'vitepress' import { useData } from 'vitepress'
import { DefaultTheme } from '../config' import { isActive } from '../support/utils'
import { isActive, normalizeLink } from '../support/utils'
import VPLink from './VPLink.vue' import VPLink from './VPLink.vue'
defineProps<{ defineProps<{

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { DefaultTheme } from '../config' import type { DefaultTheme } from 'vitepress/theme'
import VPIconDiscord from './icons/VPIconDiscord.vue' import VPIconDiscord from './icons/VPIconDiscord.vue'
import VPIconFacebook from './icons/VPIconFacebook.vue' import VPIconFacebook from './icons/VPIconFacebook.vue'
import VPIconGitHub from './icons/VPIconGitHub.vue' import VPIconGitHub from './icons/VPIconGitHub.vue'

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { DefaultTheme } from '../config' import type { DefaultTheme } from 'vitepress/theme'
import VPSocialLink from './VPSocialLink.vue' import VPSocialLink from './VPSocialLink.vue'
defineProps<{ defineProps<{

@ -1,6 +1,6 @@
import type { DefaultTheme } from 'vitepress/theme'
import { ref, computed } from 'vue' import { ref, computed } from 'vue'
import { useData, useRoute } from 'vitepress' import { useData, useRoute } from 'vitepress'
import type { DefaultTheme } from '../config'
export function useNav() { export function useNav() {
const isScreenOpen = ref(false) const isScreenOpen = ref(false)

@ -1 +0,0 @@
export { DefaultTheme } from '../shared'

@ -11,8 +11,6 @@ import { Theme } from 'vitepress'
import Layout from './Layout.vue' import Layout from './Layout.vue'
import NotFound from './NotFound.vue' import NotFound from './NotFound.vue'
export { DefaultTheme } from './config'
export { default as VPHomeHero } from './components/VPHomeHero.vue' export { default as VPHomeHero } from './components/VPHomeHero.vue'
export { default as VPHomeFeatures } from './components/VPHomeFeatures.vue' export { default as VPHomeFeatures } from './components/VPHomeFeatures.vue'
export { default as VPHomeSponsors } from './components/VPHomeSponsors.vue' export { default as VPHomeSponsors } from './components/VPHomeSponsors.vue'

@ -1,4 +1,4 @@
import { DefaultTheme } from '../config' import type { DefaultTheme } from 'vitepress/theme'
import { ensureStartingSlash } from './utils' import { ensureStartingSlash } from './utils'
/** /**

Loading…
Cancel
Save