Skip to content

Commit 3119299

Browse files
authored
feat: improve props type (#569)
1 parent 9f26a96 commit 3119299

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.changeset/early-lobsters-repeat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte-eslint-parser": minor
3+
---
4+
5+
feat: improve props type

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy