victorgarciaesgi / nuxt-typed-router

🚦Provide autocompletion and typecheck to Nuxt router
https://nuxt-typed-router.vercel.app
MIT License
362 stars 12 forks source link

NuxtLink no longer type-safe after `content.documentDriven` is configured #115

Closed cayter closed 11 months ago

cayter commented 1 year ago

Describe the bug NuxtLink no longer type-safe after content.documentDriven is configured.

Expected behavior NuxtLink should still be type-safe after content.documentDriven is configured. It seems both useContent() and useRouter().getRoutes() can be used to generate the route types.

Environnement infos

------------------------------
- Operating System: Darwin
- Node Version:     v20.5.1
- Nuxt Version:     3.7.1
- CLI Version:      3.7.3
- Nitro Version:    2.6.2
- Package Manager:  bun@0.8.2
- Builder:          -
- User Config:      content, devtools, modules
- Runtime Modules:  @nuxt/content@2.8.2, @nuxt/image@1.0.0-rc.1, @nuxt/ui@2.8.0, @nuxtjs/color-mode@3.3.0, @nuxtjs/i18n@8.0.0-rc.4, nuxt-typed-router@3.3.1
- Build Modules:    -
------------------------------

Your nuxt.config.ts

import { resolve } from "node:path";

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  content: {
    documentDriven: true,
    sources: {
      content: {
        driver: "fs",
        prefix: "/docs",
        base: resolve(__dirname, "content/docs"),
      },
    },
  },
  devtools: {
    enabled: true,
    timeline: {
      enabled: true,
    },
  },
  modules: [
    "@nuxt/content",
    "@nuxt/image",
    "@nuxt/ui",
    "@nuxtjs/color-mode",
    "@nuxtjs/i18n",
    "nuxt-typed-router",
  ],
});
victorgarciaesgi commented 1 year ago

Hi! Didn't know about this option i'll look at it What does it do ?

cayter commented 1 year ago

https://content.nuxtjs.org/guide/writing/document-driven

I am not very sure what this implies as I'm trying to co-locate my app (in pages folder) and its docs (in content folder) in the same Nuxt app. Is this a bad idea?

I just started digging into NuxtJS more seriously since yesterday after finding it much more complete as compared with React's BYOS which could help me ship faster.

victorgarciaesgi commented 11 months ago

Sorry for the late response, I have a fix, it will be published on 3.5.0

victorgarciaesgi commented 11 months ago

Fixed in v3.5.0