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:
# Kirby 6
pnpm add -D kirby-types@next
# Kirby 4 and 5
pnpm add -D kirby-typesThese pages show kirby-types 2; in v1, KirbyQueryRoot is named KirbyQueryModel.
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:
- Query Types – the shape of a query and the models it may address.
- Request Types – what you hand to
useKqland$kql. - Response Types – what comes back, including pagination.
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.