fix weird typescript linting errors

This commit is contained in:
maxDorninger
2025-08-11 21:39:51 +02:00
parent 611e066473
commit 82edbe73d8
3 changed files with 46 additions and 60 deletions

View File

@@ -1,10 +1,5 @@
import {
type RowData,
type TableOptions,
type TableOptionsResolved,
type TableState,
createTable,
} from "@tanstack/table-core";
import type { RowData, TableOptions, TableOptionsResolved, TableState } from '@tanstack/table-core';
import { createTable } from '@tanstack/table-core';
/**
* Creates a reactive TanStack table object for Svelte.
@@ -22,13 +17,13 @@ import {
* <tr>
* {#each headerGroup.headers as header}
* <th colspan={header.colSpan}>
* <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
* </th>
* <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
* </th>
* {/each}
* </tr>
* {/each}
* </thead>
* <!-- ... -->
* <!-- ... -->
* </table>
* ```
*/
@@ -43,7 +38,7 @@ export function createSvelteTable<TData extends RowData>(options: TableOptions<T
options: Partial<TableOptions<TData>>
) => {
return mergeObjects(defaultOptions, options);
},
}
},
options
);
@@ -62,7 +57,7 @@ export function createSvelteTable<TData extends RowData>(options: TableOptions<T
else state = mergeObjects(state, updater);
options.onStateChange?.(updater);
},
}
});
});
}
@@ -94,7 +89,7 @@ export function mergeObjects(...sources: any): any {
const target = {};
for (let i = 0; i < sources.length; i++) {
let source = sources[i];
if (typeof source === "function") source = source();
if (typeof source === 'function') source = source();
if (source) {
const descriptors = Object.getOwnPropertyDescriptors(source);
for (const key in descriptors) {
@@ -104,11 +99,11 @@ export function mergeObjects(...sources: any): any {
get() {
for (let i = sources.length - 1; i >= 0; i--) {
let s = sources[i];
if (typeof s === "function") s = s();
if (typeof s === 'function') s = s();
const v = (s || {})[key];
if (v !== undefined) return v;
}
},
}
});
}
}