You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- the `component` parameter expects a component constructor type, not an instance type
- use `import('svelte')` instead of relative paths to not inline all types that are already present in the sibiling module declaration
// This should contain all the public interfaces (not all of them are actually importable, check current Svelte for which ones are).
1745
-
1746
-
/**
1747
-
* @deprecated Svelte components were classes in Svelte 4. In Svelte 5, thy are not anymore.
1748
-
* Use `mount` or `createRoot` instead to instantiate components.
1749
-
* See [breaking changes](https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes)
1750
-
* for more info.
1751
-
*/
1752
-
interfaceComponentConstructorOptions<
1753
-
PropsextendsRecord<string,any>=Record<string,any>
1754
-
>{
1755
-
target: Element|Document|ShadowRoot;
1756
-
anchor?: Element;
1757
-
props?: Props;
1758
-
context?: Map<any,any>;
1759
-
hydrate?: boolean;
1760
-
intro?: boolean;
1761
-
$$inline?: boolean;
1762
-
}
1763
-
1764
-
// Utility type for ensuring backwards compatibility on a type level: If there's a default slot, add 'children' to the props if it doesn't exist there already
1765
-
typePropsWithChildren<Props,Slots>=Props&
1766
-
(Propsextends{children?: any}
1767
-
? {}
1768
-
: Slotsextends{default: any}
1769
-
? {children?: Snippet}
1770
-
: {});
1771
-
1772
-
/**
1773
-
* Can be used to create strongly typed Svelte components.
1774
-
*
1775
-
* #### Example:
1776
-
*
1777
-
* You have component library on npm called `component-library`, from which
1778
-
* you export a component called `MyComponent`. For Svelte+TypeScript users,
1779
-
* you want to provide typings. Therefore you create a `index.d.ts`:
1780
-
* ```ts
1781
-
* import { SvelteComponent } from "svelte";
1782
-
* export class MyComponent extends SvelteComponent<{foo: string}> {}
1783
-
* ```
1784
-
* Typing this makes it possible for IDEs like VS Code with the Svelte extension
1785
-
* to provide intellisense and to use the component like this in a Svelte file
1786
-
* with TypeScript:
1787
-
* ```svelte
1788
-
* <script lang="ts">
1789
-
* import { MyComponent } from "component-library";
1790
-
* </script>
1791
-
* <MyComponent foo={'bar'} />
1792
-
* ```
1793
-
*
1794
-
* This was the base class for Svelte components in Svelte 4. Svelte 5+ components
1795
-
* are completely different under the hood. You should only use this type for typing,
1796
-
* not actually instantiate components with `new` - use `mount` or `createRoot` instead.
1797
-
* See [breaking changes](https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes)
1798
-
* for more info.
1799
-
*/
1800
-
classSvelteComponent<
1801
-
PropsextendsRecord<string,any>=any,
1802
-
EventsextendsRecord<string,any>=any,
1803
-
SlotsextendsRecord<string,any>=any
1804
-
>{
1805
-
[prop: string]: any;
1806
-
/**
1807
-
* @deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which
1808
-
* is a stop-gap solution. Migrate towards using `mount` or `createRoot` instead. See
1809
-
* https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more info.
0 commit comments