Created
October 4, 2021 05:25
-
-
Save chanced/bfc4f4bfdd60077f30d0e0b043c5f81f to your computer and use it in GitHub Desktop.
Couple of utility types for extracting svelte constructor options & svelte component props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type SvelteComponentConstructorOptions<T> = T extends abstract new ( | |
opts: Svelte2TsxComponentConstructorParameters<infer P>, | |
) => any | |
? Svelte2TsxComponentConstructorParameters<P> | |
: never; | |
export type SvelteComponentProps<T> = T extends abstract new ( | |
opts: Svelte2TsxComponentConstructorParameters<infer P>, | |
) => any | |
? Svelte2TsxComponentConstructorParameters<P>["props"] | |
: never; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: