mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-27 10:20:42 +01:00
docs(HighlightInlintType): hide undefined in types
This commit is contained in:
@@ -4,17 +4,24 @@ const props = defineProps<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const type = computed(() => {
|
const type = computed(() => {
|
||||||
if (props.type.includes(', "as" | "asChild" | "forceMount">')) {
|
let type = props.type
|
||||||
return props.type.replace(`, "as" | "asChild" | "forceMount">`, ``).replace('Omit<', '')
|
if (type.includes(', "as" | "asChild" | "forceMount">')) {
|
||||||
|
type = type.replace(`, "as" | "asChild" | "forceMount">`, ``).replace('Omit<', '')
|
||||||
}
|
}
|
||||||
if (props.type.includes(', "as" | "asChild">')) {
|
if (type.includes(', "as" | "asChild">')) {
|
||||||
return props.type.replace(', "as" | "asChild">', '').replace('Omit<', '')
|
type = type.replace(', "as" | "asChild">', '').replace('Omit<', '')
|
||||||
|
}
|
||||||
|
if (type.startsWith('undefined |')) {
|
||||||
|
type = type.replace('undefined |', '')
|
||||||
|
}
|
||||||
|
if (type.endsWith('| undefined')) {
|
||||||
|
type = type.replace('| undefined', '')
|
||||||
}
|
}
|
||||||
|
|
||||||
return props.type
|
return type
|
||||||
})
|
})
|
||||||
|
|
||||||
const { data: ast } = await useAsyncData(`hightlight-inline-code-${props.type}`, () => parseMarkdown(`\`${type.value}\`{lang="ts-type"}`))
|
const { data: ast } = await useAsyncData(`hightlight-inline-code-${type.value}`, () => parseMarkdown(`\`${type.value}\`{lang="ts-type"}`))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user