UNPKG

@tanstack/table-core

Version:

Headless UI for building powerful tables & datagrids for TS/JS.

28 lines (27 loc) 944 B
//#region src/helpers/metaHelper.ts /** * A helper for declaring the `tableMeta`/`columnMeta` type-only slots in the * `features` option without a type assertion. * * Equivalent to `{} as TMeta`, but reads as type-only at the call site and * avoids `@typescript-eslint/no-unnecessary-type-assertion` false positives * when the meta type has only optional properties (where an auto-fix removing * the assertion would silently degrade the inferred meta type to `{}`). * * The returned value is a phantom — it is ignored and stripped from the * table's registered features at runtime; only its type is used. * @example * ``` * import { metaHelper, tableFeatures, rowSortingFeature } from '@tanstack/react-table' * const features = tableFeatures({ * rowSortingFeature, * tableMeta: metaHelper<MyTableMeta>(), * columnMeta: metaHelper<MyColumnMeta>(), * }); * ``` */ function metaHelper() { return {}; } //#endregion export { metaHelper };