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,