Skip to content

[svelte] add types to renderComponent - #4516

Merged
tannerlinsley merged 1 commit into
TanStack:mainfrom
thenbe:main
Nov 12, 2022
Merged

[svelte] add types to renderComponent#4516
tannerlinsley merged 1 commit into
TanStack:mainfrom
thenbe:main

Conversation

@thenbe

@thenbe thenbe commented Nov 12, 2022

Copy link
Copy Markdown
Contributor

New types ComponentProps and ComponentType were added in version 3.49 of svelte. We can use them to make renderComponent a generic function, where the props argument can reflect the given component's expected props.

Implementation taken from here: https://github.com/ivanhofer/sveltekit-typescript-showcase/blob/main/src/01-props/09-svelte-component/Component.svelte

@tannerlinsley
tannerlinsley merged commit 1ec3cab into TanStack:main Nov 12, 2022
@KevinVandy

Copy link
Copy Markdown
Member

@ambiguous48 @tannerlinsley It looks like the new types are causing typescript issues with the renderComponent method. The types need to be updated there too, or else the build will continue to fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants