Skip to content

Using Types

The types Nuxt Kirby ships for Kirby data and queries, and where each one applies.

INFO

These types belong to the kirby-types package – import them from there. The #nuxt-kirby alias re-exports the same names next to your prefetched queries, so both paths resolve to the same types.

Nuxt Kirby depends on kirby-types, but a package manager that does not hoist – pnpm out of the box – keeps a dependency of a dependency out of your project's node_modules. Add it yourself so the import resolves:

bash
pnpm add -D kirby-types
ts
import type {
  KirbyApiResponse,
  KirbyBlock,
  KirbyDefaultBlocks,
  KirbyDefaultBlockType,
  KirbyLayout,
  KirbyLayoutColumn,
  KirbyQuery,
  KirbyQueryChain,
  KirbyQueryModel,
  KirbyQueryRequest,
  KirbyQueryResponse,
  KirbyQuerySchema,
} from 'kirby-types'

Each type is documented on the page for its area:

To type the result of a query rather than the envelope around it, see Typed Query Results.

Released under the MIT License.