NuxtN
Nuxt3y ago
2 replies
MrBear038

Please how can I use the types of a Nitro server route in a declaration file

In the root of my project, I have a project.d.ts which contains all the types used in a Nuxt 3 project. I would like to create a type for the response of /api/users route which returns

[
  {name: "John Doe", age: 40},
  {name: "Mary Doe", age: 35},
]


But I don't know how to do it, here's a reproduction link:
https://codesandbox.io/p/sandbox/loving-hooks-7lci64
CodeSandbox is an online editor tailored for web applications.
loving-hooks-7lci64
Was this page helpful?