diff --git a/examples/angular/grouping/src/app/app.component.ts b/examples/angular/grouping/src/app/app.component.ts index ec2f6218f5..023f5663f7 100644 --- a/examples/angular/grouping/src/app/app.component.ts +++ b/examples/angular/grouping/src/app/app.component.ts @@ -56,13 +56,9 @@ export class AppComponent { rowExpandingFeature, }, _rowModels: { - // @ts-expect-error Fix type groupedRowModel: createGroupedRowModel(), - // @ts-expect-error Fix type expandedRowModel: createExpandedRowModel(), - // @ts-expect-error Fix type paginatedRowModel: createPaginatedRowModel(), - // @ts-expect-error Fix type filteredRowModel: createFilteredRowModel(), }, onGroupingChange: (updaterOrValue: Updater) => { diff --git a/examples/angular/row-selection-signal/src/app/app.component.ts b/examples/angular/row-selection-signal/src/app/app.component.ts index 599724e905..4a4a048462 100644 --- a/examples/angular/row-selection-signal/src/app/app.component.ts +++ b/examples/angular/row-selection-signal/src/app/app.component.ts @@ -108,9 +108,7 @@ export class AppComponent { columnVisibilityFeature, }, _rowModels: { - // @ts-expect-error Fix type filteredRowModel: createFilteredRowModel(), - // @ts-expect-error Fix type paginatedRowModel: createPaginatedRowModel(), }, columns: this.columns, diff --git a/packages/angular-table/src/createTableHelperCore.ts b/packages/angular-table/src/constructTableHelper.ts similarity index 100% rename from packages/angular-table/src/createTableHelperCore.ts rename to packages/angular-table/src/constructTableHelper.ts diff --git a/packages/angular-table/src/createTableHelper.ts b/packages/angular-table/src/createTableHelper.ts index 6f4738072c..b4f6d2a787 100644 --- a/packages/angular-table/src/createTableHelper.ts +++ b/packages/angular-table/src/createTableHelper.ts @@ -1,4 +1,5 @@ -import { constructTableHelper } from './createTableHelperCore' +import { Signal } from '@angular/core' +import { constructTableHelper } from './constructTableHelper' import { injectTable } from './injectTable' import type { RowData, @@ -27,7 +28,12 @@ export function createTableHelper< >( tableHelperOptions: TableHelperOptions, ): TableHelper { - const tableHelper = constructTableHelper(injectTable, tableHelperOptions) + const tableHelper = constructTableHelper( + injectTable as unknown as ( + tableOptions: () => TableOptions, + ) => Table & Signal>, + tableHelperOptions, + ) return { ...tableHelper, injectTable: tableHelper.tableCreator, diff --git a/packages/angular-table/src/injectTable.ts b/packages/angular-table/src/injectTable.ts index a334bcd0f8..8b74b84b25 100644 --- a/packages/angular-table/src/injectTable.ts +++ b/packages/angular-table/src/injectTable.ts @@ -9,6 +9,7 @@ import { lazyInit } from './lazy-signal-initializer' import { proxifyTable } from './proxy' import { reactivityFeature } from './reactivity' import type { + CreateRowModels_All, RowData, Table, TableFeatures, @@ -17,11 +18,20 @@ import type { } from '@tanstack/table-core' import type { Signal } from '@angular/core' +export type AngularTableOptions< + TFeatures extends TableFeatures, + TData extends RowData, +> = Omit, '_rowModels'> & { + _rowModels: CreateRowModels_All + // TODO: no exported + // _rowModelsFns: RowModelFns +} + export function injectTable< TFeatures extends TableFeatures, TData extends RowData, >( - options: () => TableOptions, + options: () => AngularTableOptions, ): Table & Signal> { return lazyInit(() => { const features = () => { @@ -41,7 +51,7 @@ export function injectTable< ...options(), _features: features(), state: { ...state(), ...options().state }, - } + } as TableOptions const table = constructTable(resolvedOptions)