diff --git a/packages/plugin-kanban/README.md b/packages/plugin-kanban/README.md index 612b92e268..74d3d42d63 100644 --- a/packages/plugin-kanban/README.md +++ b/packages/plugin-kanban/README.md @@ -103,12 +103,26 @@ const schema: KanbanSchema = { ## Schema API ```typescript -{ +import type { KanbanSchema } from '@object-ui/plugin-kanban'; + +declare const columns: KanbanColumn[]; + +// The board document. `type` is the only required member — `columns`, +// `onCardMove` and `className` are all optional. The annotation is the type +// this package ships, so each member below is compiled against it rather than +// read as prose: a `columns` array of the wrong shape, or an `onCardMove` +// whose parameters drift from the shipped signature, fails here. An unknown +// key does not — `KanbanSchema` extends `BaseSchema`, whose index signature +// deliberately accepts type-specific extensions, so the compiler is not what +// catches a misspelt board key. +const board: KanbanSchema = { type: 'kanban', - columns?: KanbanColumn[], // Array of columns - onCardMove?: (cardId, fromColumnId, toColumnId, newIndex) => void, - className?: string // Tailwind classes -} + columns, // Array of columns + onCardMove: (cardId, fromColumnId, toColumnId, newIndex) => { + // see "Example with Callbacks" below + }, + className: 'h-full', // Tailwind classes +}; // Column structure interface KanbanColumn { @@ -183,9 +197,13 @@ pnpm build ## Example with Callbacks ```typescript -const schema = { +import type { KanbanColumn, KanbanSchema } from '@object-ui/plugin-kanban'; + +declare const columns: KanbanColumn[]; + +const schema: KanbanSchema = { type: 'kanban', - columns: [...], + columns, onCardMove: (cardId, fromColumnId, toColumnId, newIndex) => { console.log(`Card ${cardId} moved from ${fromColumnId} to ${toColumnId} at index ${newIndex}`); // Update your backend or state here diff --git a/scripts/check-doc-snippet-types.mjs b/scripts/check-doc-snippet-types.mjs index e84025fbb6..fe7e896c25 100644 --- a/scripts/check-doc-snippet-types.mjs +++ b/scripts/check-doc-snippet-types.mjs @@ -716,8 +716,6 @@ const UNGATED_DOCS = { '5 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines; 1 unresolved-module diagnostic(s); plus TS17000x1 TS2322x1 — candidate real defects, un-triaged', 'packages/plugin-editor/README.md': '6 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies', - 'packages/plugin-kanban/README.md': - '6 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies', 'packages/plugin-map/README.md': '1 parse diagnostic(s) — blocks fenced `ts` that are bare object literals or elided bodies; 1 undefined-name diagnostic(s) — blocks continue an earlier block, or use ambient names the page never defines; plus TS2322x1 — candidate real defects, un-triaged', 'packages/plugin-markdown/README.md':