Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit ea26456

Browse files
committed
fix: type errors
1 parent 6560dc5 commit ea26456

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

components/PanelDocs.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- eslint-disable vue/return-in-computed-property -->
12
<script setup lang="ts">
23
import type { NavItem, ParsedContent } from '@nuxt/content'
34
@@ -83,11 +84,14 @@ const THREAD_ID_MAP = {
8384
'2.concepts/9.data-fetching/index.md': 84,
8485
} as const satisfies Record<string, number>
8586
86-
const threadUrl = computed(() =>
87-
page.value?._file && threadIdMappings[page.value._file]
88-
? `https://github.com/vuejs-jp/learn.nuxt.com/discussions/${threadIdMappings[page.value._file]}`
89-
: undefined,
90-
)
87+
type ThreadIdMapKey = keyof typeof THREAD_ID_MAP
88+
89+
const threadUrl = computed(() => {
90+
if (page.value?._file) {
91+
const threadId = THREAD_ID_MAP[page.value._file as ThreadIdMapKey]
92+
return `https://github.com/vuejs-jp/learn.nuxt.com/discussions/${threadId}`
93+
}
94+
})
9195
9296
const docsEl = ref<HTMLElement | null>(null)
9397
const router = useRouter()

0 commit comments

Comments
 (0)