Skip to content

Commit 31b94b0

Browse files
authored
feat(svelte): types reworked for Svelte 4 (#4216)
1 parent 34ad1fb commit 31b94b0

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/build-svelte-typings.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ const fs = require('./utils/fs-extra.js');
88
const { COLOR_PROPS, ICON_PROPS, ROUTER_PROPS, ACTIONS_PROPS } = require('./ts-extend-props.js');
99

1010
const TEMPLATE = `
11-
import { SvelteComponentTyped } from 'svelte';
11+
import { SvelteComponent } from 'svelte';
12+
import { HTMLAttributes } from 'svelte/elements';
1213
{{IMPORTS}}
1314
14-
interface {{componentName}}Props extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap['div']> {
15+
interface {{componentName}}Props {
1516
{{PROPS}}
1617
}
1718
1819
{{EXTENDS}}
1920
20-
declare class {{componentName}} extends SvelteComponentTyped<
21-
{{componentName}}Props,
21+
declare class {{componentName}} extends SvelteComponent<
22+
{{componentName}}Props & Omit<HTMLAttributes<HTMLElementTagNameMap['div']>, keyof {{componentName}}Props>,
2223
{ {{EVENTS}} },
2324
{ {{SLOTS}} }
2425
> {}
@@ -47,7 +48,7 @@ function generateComponentProps(propsContent) {
4748
}
4849
props[propName] = propValue.trim();
4950
});
50-
['id', 'style', 'className', 'ref', 'slot'].forEach((key) => {
51+
['id', 'style', 'className', 'ref', 'slot', 'children'].forEach((key) => {
5152
delete props[key];
5253
});
5354
const content = Object.keys(props)

0 commit comments

Comments
 (0)