Skip to content

Using Types ​

The types 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 exports the module's own option types: AllowedRoute, KqlOptions, KirbyFetchOptions, UseKqlOptions, UseKirbyDataOptions, NitroKqlFetchOptions and NitroKirbyFetchOptions.

kirby-types is a peer dependency of Nuxt Kirby. Add it to your project – v2 for Kirby 6, published under the next tag, or v1 for Kirby 4 and 5:

bash
# Kirby 6
pnpm add -D kirby-types@next

# Kirby 4 and 5
pnpm add -D kirby-types

These pages show kirby-types 2; in v1, KirbyQueryRoot is named KirbyQueryModel.

ts
import type {
  KirbyApiResponse,
  KirbyBlock,
  KirbyDefaultBlocks,
  KirbyDefaultBlockType,
  KirbyLayout,
  KirbyLayoutColumn,
  KirbyQuery,
  KirbyQueryChain,
  KirbyQueryRequest,
  KirbyQueryResponse,
  KirbyQueryRoot,
  KirbyQuerySchema,
} from 'kirby-types'

Each type is documented on the page for its area:

The block and layout types (KirbyBlock, KirbyLayout, …) are covered by the kirby-types README.

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

Released under the MIT License.