grid icon indicating copy to clipboard operation
grid copied to clipboard

`IHeaderCellConfig` type does not match implementation

Open tomatrow opened this issue 7 months ago • 2 comments

The IHeaderCellConfig doesn't seem to match the implementation.

https://github.com/svar-widgets/grid/blob/ef5efdba4fd4c9dc7a8d7a56dca1f307ca3c8577/svelte/types/index.d.ts#L44-L50

e.g. the implementation hasgetRowIndex on the header cell api and getState/getReactiveState do not return the full table api.

I'm using the following patch in my project to match types to implementation:

diff --git a/types/index.d.ts b/types/index.d.ts
index fa9ca873165746354be8a452494abd73f09a9827..125afb45cc08dc391babee221a71cf5b8bfd7e8b 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -41,12 +41,24 @@ export interface ICellProps {
 	onaction: (ev: { action?: any; data?: { [key: string]: any } }) => void;
 }
 
+export interface IHeaderCellApi {
+	exec: IApi["exec"];
+	getState: IApi["getState"];
+	getReactiveState: IApi["getReactiveState"];
+	getRow: IApi["getRow"];
+	getRowIndex: (id: number | string, data?: unknown[]) => number;
+}
+
+export interface IHeaderCellProps {
+	api: IHeaderCellApi;
+	row: number;
+	column: IColumn;
+	cell: Omit<IHeaderCell, "cell">;
+	onaction: (ev: { action?: any; data?: { [key: string]: any } }) => void;
+}
+
 export interface IHeaderCellConfig extends IHeaderCell {
-	cell?: Component<
-		ICellProps & {
-			cell: Omit<IHeaderCell, "cell">;
-		}
-	>;
+	cell?: Component<IHeaderCellProps>;
 }
 
 export type TColumnHeaderConfig =

tomatrow avatar Apr 24 '26 21:04 tomatrow

Hello @tomatrow,

Thank you for the detailed report! This is a bug. The fix is expected to be included in the next patch release.

Natasha-eng avatar Apr 30 '26 06:04 Natasha-eng

Hello @tomatrow , I’m pleased to let you know that the issue you reported with type mismatch has been fixed in Svelte Grid v2.7.

Natasha-eng avatar Jun 05 '26 07:06 Natasha-eng