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
  9c61a142_0dba_5def_1f8c_7ae9a3fd7dcb["SvelteComponent"]
  6bd9d090_a582_e05c_669e_d53d4e7245f2["index.d.ts"]
  9c61a142_0dba_5def_1f8c_7ae9a3fd7dcb -->|defined in| 6bd9d090_a582_e05c_669e_d53d4e7245f2
  8e776b0e_e937_1c28_2917_6e1fbfb060aa["constructor()"]
  9c61a142_0dba_5def_1f8c_7ae9a3fd7dcb -->|method| 8e776b0e_e937_1c28_2917_6e1fbfb060aa
  9791c1c3_df09_2b2d_87b5_0ec6687fd052["$destroy()"]
  9c61a142_0dba_5def_1f8c_7ae9a3fd7dcb -->|method| 9791c1c3_df09_2b2d_87b5_0ec6687fd052
  d1a4543f_cedc_f7b8_d998_216a612900d7["$on()"]
  9c61a142_0dba_5def_1f8c_7ae9a3fd7dcb -->|method| d1a4543f_cedc_f7b8_d998_216a612900d7
  c3df67f2_cd1c_ff00_7133_d08cdceaf2a2["$set()"]
  9c61a142_0dba_5def_1f8c_7ae9a3fd7dcb -->|method| c3df67f2_cd1c_ff00_7133_d08cdceaf2a2

Relationship Graph

Source Code

packages/svelte/types/index.d.ts lines 44–107

	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/types/index.d.ts.
Where is SvelteComponent defined?
SvelteComponent is defined in packages/svelte/types/index.d.ts at line 44.

Analyze Your Own Codebase

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

Try Supermodel Free