A collection of TypeScript types to work with Kirby CMS, mainly in the context of the Kirby Query Language and headless Kirby usage.
# pnpm
pnpm add -D kirby-types
# npm
npm i -D kirby-types
# yarn
yarn add -D kirby-types
import type { KirbyQuery } from "kirby-types";
// Strictly typed query
const query: KirbyQuery = 'page.children.filterBy("featured", true)';
// Invalid queries will throw a type error
let invalidQuery: KirbyQuery;
invalidQuery = "unknown"; // Not a valid model
invalidQuery = 'site("'; // Empty parentheses
invalidQuery = 'site("value"'; // Missing closing parenthesis
By clicking on a type name, you will be redirected to the corresponding TypeScript definition file.
-
KirbyApiResponse
- Matches the response of a Kirby API request.
-
KirbyQueryModel
- Matches any supported KirbyQL model. -
KirbyQuery
- Matches a KirbyQLquery
.
-
KirbyBlock
- Matches a Kirby block. -
KirbyDefaultBlockType
- Matches any Kirby default block type. -
KirbyDefaultBlocks
- Maps each of Kirby's default block type to its corresponding block content.
-
KirbyLayout
- Matches a Kirby layout. -
KirbyLayoutColumn
- Matches any supported layout width.
-
KirbyQuerySchema
- Matches a KQL query schema. -
KirbyQueryRequest
- Matches any KQL request. -
KirbyQueryResponse
- Matches any KQL response.
MIT License © 2022-PRESENT Johann Schopplich