Skip to content

Commit b1a8038

Browse files
authored
fix: make static element property available (#11079)
for the SvelteComponent type closes #8936
1 parent 6b7f116 commit b1a8038

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

.changeset/eight-hornets-punch.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte": patch
3+
---
4+
5+
fix: make static `element` property available for the SvelteComponent type

packages/svelte/src/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export class SvelteComponent<
5959
Events extends Record<string, any> = any,
6060
Slots extends Record<string, any> = any
6161
> {
62+
/** The custom element version of the component. Only present if compiled with the `customElement` compiler option */
63+
static element?: typeof HTMLElement;
64+
6265
[prop: string]: any;
6366
/**
6467
* @deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which

packages/svelte/tests/types/component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
hydrate
99
} from 'svelte';
1010

11+
SvelteComponent.element === HTMLElement;
12+
1113
// --------------------------------------------------------------------------- legacy: classes
1214

1315
class LegacyComponent extends SvelteComponent<

packages/svelte/types/index.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ declare module 'svelte' {
6060
Events extends Record<string, any> = any,
6161
Slots extends Record<string, any> = any
6262
> {
63+
/** The custom element version of the component. Only present if compiled with the `customElement` compiler option */
64+
static element?: typeof HTMLElement;
65+
6366
[prop: string]: any;
6467
/**
6568
* @deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which

0 commit comments

Comments
 (0)