mirror of https://github.com/sveltejs/svelte
feat: migrate `Component` to `ComponentExports<typeof Component>` in TS (#13656)
Closes #13491 --------- Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>pull/14064/head
parent
d93ad3ba1e
commit
4715dfaad2
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: migrate `Component` to `ComponentExports<typeof Component>` in TS
|
@ -0,0 +1,18 @@
|
||||
<script lang="ts">
|
||||
import Component from "./Component.svelte";
|
||||
import type ComponentType from "./Component.svelte";
|
||||
|
||||
export let my_comp: Component;
|
||||
|
||||
export let my_component_type: ComponentType;
|
||||
|
||||
export function enhance(comp: Component, comp_type: ComponentType){
|
||||
|
||||
}
|
||||
|
||||
let comp: Component | ComponentType | undefined = undefined;
|
||||
|
||||
export const the_comp: Component | ComponentType = comp;
|
||||
</script>
|
||||
|
||||
<Component bind:this={comp} />
|
@ -0,0 +1,22 @@
|
||||
<script lang="ts">
|
||||
import Component from "./Component.svelte";
|
||||
import type ComponentType from "./Component.svelte";
|
||||
|
||||
|
||||
interface Props {
|
||||
my_comp: import('svelte').ComponentExports<typeof Component>;
|
||||
my_component_type: import('svelte').ComponentExports<typeof ComponentType>;
|
||||
}
|
||||
|
||||
let { my_comp, my_component_type }: Props = $props();
|
||||
|
||||
export function enhance(comp: import('svelte').ComponentExports<typeof Component>, comp_type: import('svelte').ComponentExports<typeof ComponentType>){
|
||||
|
||||
}
|
||||
|
||||
let comp: import('svelte').ComponentExports<typeof Component> | import('svelte').ComponentExports<typeof ComponentType> | undefined = $state(undefined);
|
||||
|
||||
export const the_comp: import('svelte').ComponentExports<typeof Component> | import('svelte').ComponentExports<typeof ComponentType> = comp;
|
||||
</script>
|
||||
|
||||
<Component bind:this={comp} />
|
Loading…
Reference in new issue