Skip to content

Commit a4837cd

Browse files
committed
fix: improve types
1 parent ac16c28 commit a4837cd

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

components/content/ProseH1.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
const props = defineProps<{ id?: string }>()
2+
const { id } = defineProps<{ id?: string }>()
33
44
const { headings } = useRuntimeConfig().public.mdc
5-
const generate = computed(() => props.id && headings?.anchorLinks?.h1)
5+
const generate = computed(() => id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h1)))
66
</script>
77

88
<template>
9-
<h1 :id="id" class="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl">
9+
<h1 :id class="scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl">
1010
<NuxtLink
1111
v-if="generate"
1212
:to="`#${id}`"

components/content/ProseH2.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
const props = defineProps<{ id?: string }>()
2+
const { id } = defineProps<{ id?: string }>()
33
44
const { headings } = useRuntimeConfig().public.mdc
5-
const generate = computed(() => props.id && headings?.anchorLinks?.h2)
5+
const generate = computed(() => id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h2)))
66
</script>
77

88
<template>
9-
<h2 :id="id" class="scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors [&:not(:first-child)]:mt-10">
9+
<h2 :id class="scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight transition-colors [&:not(:first-child)]:mt-10">
1010
<NuxtLink
1111
v-if="id && generate"
1212
:to="`#${id}`"

components/content/ProseH3.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
const props = defineProps<{ id?: string }>()
2+
const { id } = defineProps<{ id?: string }>()
33
44
const { headings } = useRuntimeConfig().public.mdc
5-
const generate = computed(() => props.id && headings?.anchorLinks?.h3)
5+
const generate = computed(() => id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h3)))
66
</script>
77

88
<template>
9-
<h3 :id="id" class="scroll-m-20 text-2xl font-semibold tracking-tight [&:not(:first-child)]:mt-8">
9+
<h3 :id class="scroll-m-20 text-2xl font-semibold tracking-tight [&:not(:first-child)]:mt-8">
1010
<NuxtLink
1111
v-if="id && generate"
1212
:to="`#${id}`"

components/content/ProseH4.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
const props = defineProps<{ id?: string }>()
2+
const { id } = defineProps<{ id?: string }>()
33
44
const { headings } = useRuntimeConfig().public.mdc
5-
const generate = computed(() => props.id && headings?.anchorLinks?.h4)
5+
const generate = computed(() => id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h4)))
66
</script>
77

88
<template>
9-
<h4 :id="id" class="scroll-m-20 text-xl font-semibold tracking-tight [&:not(:first-child)]:mt-6">
9+
<h4 :id class="scroll-m-20 text-xl font-semibold tracking-tight [&:not(:first-child)]:mt-6">
1010
<NuxtLink
1111
v-if="id && generate"
1212
:to="`#${id}`"

components/content/ProseH5.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
const props = defineProps<{ id?: string }>()
2+
const { id } = defineProps<{ id?: string }>()
33
44
const { headings } = useRuntimeConfig().public.mdc
5-
const generate = computed(() => props.id && headings?.anchorLinks?.h4)
5+
const generate = computed(() => id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h5)))
66
</script>
77

88
<template>
9-
<h5 :id="id" class="scroll-m-20 text-lg font-semibold tracking-tight [&:not(:first-child)]:mt-6">
9+
<h5 :id class="scroll-m-20 text-lg font-semibold tracking-tight [&:not(:first-child)]:mt-6">
1010
<NuxtLink
1111
v-if="id && generate"
1212
:to="`#${id}`"

components/content/ProseH6.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
const props = defineProps<{ id?: string }>()
2+
const { id } = defineProps<{ id?: string }>()
33
44
const { headings } = useRuntimeConfig().public.mdc
5-
const generate = computed(() => props.id && headings?.anchorLinks?.h4)
5+
const generate = computed(() => id && ((typeof headings?.anchorLinks === 'boolean' && headings?.anchorLinks === true) || (typeof headings?.anchorLinks === 'object' && headings?.anchorLinks?.h6)))
66
</script>
77

88
<template>
9-
<h6 :id="id" class="scroll-m-20 text-lg font-semibold tracking-tight [&:not(:first-child)]:mt-6">
9+
<h6 :id class="scroll-m-20 text-lg font-semibold tracking-tight [&:not(:first-child)]:mt-6">
1010
<NuxtLink
1111
v-if="id && generate"
1212
:to="`#${id}`"

0 commit comments

Comments
 (0)