From 55f7f8b78cce521f100a71ed209f80d38d5b9376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20R=C3=B8ed?= Date: Wed, 23 Sep 2026 01:14:25 +0200 Subject: [PATCH] Export CellOptions and CellOptionsOf `CellOptions` is what the `options` callback of a column config must return, and `CellOptionsOf` is what `getOptionsForRow` gives a Cell. Both are part of the surface an app writes against, but neither could be named. Cowritten by Claude --- .../-type-tests/public-option-types.test.ts | 22 +++++++++++++++++++ table/src/index.ts | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 table/src/-private/-type-tests/public-option-types.test.ts diff --git a/table/src/-private/-type-tests/public-option-types.test.ts b/table/src/-private/-type-tests/public-option-types.test.ts new file mode 100644 index 0000000..161e471 --- /dev/null +++ b/table/src/-private/-type-tests/public-option-types.test.ts @@ -0,0 +1,22 @@ +import { expectTypeOf } from 'expect-type'; + +import type { CellContext, CellOptions, CellOptionsOf } from '../../index.ts'; + +interface Person { + name: string; +} + +// An app writing an `options` callback names what it must return. +const options = (_context: CellContext): CellOptions => ({ + defaultValue: '--', + unit: 'years', +}); + +expectTypeOf(options).returns.toEqualTypeOf(); + +// And code that takes what `getOptionsForRow` gives a Cell names that. +interface UnitCellArgs { + options: { unit: string }; +} + +expectTypeOf>().toEqualTypeOf<{ unit: string }>(); diff --git a/table/src/index.ts b/table/src/index.ts index af8b79b..3bc8f27 100644 --- a/table/src/index.ts +++ b/table/src/index.ts @@ -11,8 +11,10 @@ export { deserializeSorts, serializeSorts } from './utils.ts'; * Public Types *******************************/ export type { Column } from './-private/column.ts'; +export type { CellOptionsOf } from './-private/meta.ts'; export type { CellContext, + CellOptions, ColumnConfig, ColumnKey, HeadlessTableConfig,