Home / Class/ SvelteComponent Class — svelte Architecture

SvelteComponent Class — svelte Architecture

Architecture documentation for the SvelteComponent class in index.d.ts from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  f7276ec4_6353_1c52_0da3_0b28095aea62["SvelteComponent"]
  d5f75cc7_4dc4_5b53_55c5_43ee635d6602["index.d.ts"]
  f7276ec4_6353_1c52_0da3_0b28095aea62 -->|defined in| d5f75cc7_4dc4_5b53_55c5_43ee635d6602
  64813217_8eae_4733_225b_2e2383802331["constructor()"]
  f7276ec4_6353_1c52_0da3_0b28095aea62 -->|method| 64813217_8eae_4733_225b_2e2383802331
  8d9bfbd2_a1f6_3d2b_3d81_6492f9cdf6bd["$destroy()"]
  f7276ec4_6353_1c52_0da3_0b28095aea62 -->|method| 8d9bfbd2_a1f6_3d2b_3d81_6492f9cdf6bd
  3e7ca392_f4bf_bcdd_529d_2ce776dcf8c1["$on()"]
  f7276ec4_6353_1c52_0da3_0b28095aea62 -->|method| 3e7ca392_f4bf_bcdd_529d_2ce776dcf8c1
  fb6af13d_684e_040f_acf3_f8772901fe25["$set()"]
  f7276ec4_6353_1c52_0da3_0b28095aea62 -->|method| fb6af13d_684e_040f_acf3_f8772901fe25

Relationship Graph

Source Code

packages/svelte/src/index.d.ts lines 45–108

export class SvelteComponent<
	Props extends Record<string, any> = Record<string, any>,
	Events extends Record<string, any> = any,
	Slots extends Record<string, any> = any
> {
	/** The custom element version of the component. Only present if compiled with the `customElement` compiler option */
	static element?: typeof HTMLElement;

	[prop: string]: any;
	/**
	 * @deprecated This constructor only exists when using the `asClassComponent` compatibility helper, which
	 * is a stop-gap solution. Migrate towards using `mount` instead. See
	 * [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes) for more info.
	 */
	constructor(options: ComponentConstructorOptions<Properties<Props, Slots>>);
	/**
	 * For type checking capabilities only.
	 * Does not exist at runtime.
	 * ### DO NOT USE!
	 */
	$$prop_def: Props; // Without Properties: unnecessary, causes type bugs
	/**
	 * For type checking capabilities only.
	 * Does not exist at runtime.
	 * ### DO NOT USE!
	 */
	$$events_def: Events;
	/**
	 * For type checking capabilities only.
	 * Does not exist at runtime.
	 * ### DO NOT USE!
	 */
	$$slot_def: Slots;
	/**
	 * For type checking capabilities only.
	 * Does not exist at runtime.
	 * ### DO NOT USE!
	 */
	$$bindings?: string;

	/**
	 * @deprecated This method only exists when using one of the legacy compatibility helpers, which
	 * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes)
	 * for more info.
	 */
	$destroy(): void;

	/**
	 * @deprecated This method only exists when using one of the legacy compatibility helpers, which
	 * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes)
	 * for more info.
	 */
	$on<K extends Extract<keyof Events, string>>(
		type: K,
		callback: (e: Events[K]) => void
	): () => void;

	/**
	 * @deprecated This method only exists when using one of the legacy compatibility helpers, which
	 * is a stop-gap solution. See [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes)
	 * for more info.
	 */
	$set(props: Partial<Props>): void;
}

Frequently Asked Questions

What is the SvelteComponent class?
SvelteComponent is a class in the svelte codebase, defined in packages/svelte/src/index.d.ts.
Where is SvelteComponent defined?
SvelteComponent is defined in packages/svelte/src/index.d.ts at line 45.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free