Skip to content

Commit c74bf0e

Browse files
committed
feat: improve props type
1 parent 9f26a96 commit c74bf0e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/parser/converts/attr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ function buildAttributeType(
293293
return null;
294294
}
295295
const elementName = ctx.elements.get(element)!.name;
296-
const componentPropsType = `import('svelte').ComponentProps<${elementName}>`;
296+
const componentPropsType = `import('svelte').ComponentProps<typeof ${elementName}>`;
297297
return conditional({
298298
check: `'${attrName}'`,
299299
extends: `infer PROP`,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts">
2-
import Component from './ts-event03-input.svelte'; // Component: __sveltets_2_IsomorphicComponent<$$ComponentProps, { [evt: string]: CustomEvent<any>; }, {}, Record<string, any>, string>
2+
import Component from './ts-event03-input.svelte'; // Component: Component<$$ComponentProps, {}, "">
33
</script>
44

5-
<Component onfoo="{e=>{ // Component: __sveltets_2_IsomorphicComponent<$$ComponentProps, { [evt: string]: CustomEvent<any>; }, {}, Record<string, any>, string>, e: { detail: number; }
5+
<Component onfoo="{e=>{ // Component: Component<$$ComponentProps, {}, "">, e: { detail: number; }
66
// e.detail is number
77
e.detail; // e.detail: number
88
}}" />

0 commit comments

Comments
 (0)