Skip to content

Commit

Permalink
fix: svelte type cast the results of renderComponent (#4932)
Browse files Browse the repository at this point in the history
  • Loading branch information
thenbe committed Jul 1, 2023
1 parent 958ae6e commit 50cc8d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/svelte-table/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ComponentType } from 'svelte'
import {
RowData,
createTable,
Expand Down Expand Up @@ -44,7 +45,7 @@ function wrapInPlaceholder(content: any) {
return renderComponent(Placeholder, { content })
}

export function flexRender(component: any, props: any) {
export function flexRender(component: any, props: any): ComponentType | null {
if (!component) return null

if (isSvelteComponent(component)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/svelte-table/src/render-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function renderClient<T>(
undefined
)
}
}
} as ComponentType
}

function renderServer<T>(
Expand All @@ -82,7 +82,7 @@ function renderServer<T>(
}
)

return WrapperComp
return WrapperComp as unknown as ComponentType
}

export const renderComponent =
Expand Down

0 comments on commit 50cc8d4

Please sign in to comment.