Home / Type/ ClientTransformState Type — svelte Architecture

ClientTransformState Type — svelte Architecture

Architecture documentation for the ClientTransformState type/interface in types.d.ts from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  18e0d8cd_aa1a_f8fc_6bd1_4accc0c46daf["ClientTransformState"]
  e958f40a_bb26_89ce_018e_c2acc509a051["types.d.ts"]
  18e0d8cd_aa1a_f8fc_6bd1_4accc0c46daf -->|defined in| e958f40a_bb26_89ce_018e_c2acc509a051
  style 18e0d8cd_aa1a_f8fc_6bd1_4accc0c46daf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/3-transform/client/types.d.ts lines 17–37

export interface ClientTransformState extends TransformState {
	/**
	 * `true` if the current lexical scope belongs to a class constructor. this allows
	 * us to rewrite `this.foo` as `this.#foo.value`
	 */
	readonly in_constructor: boolean;

	readonly transform: Record<
		string,
		{
			/** turn `foo` into e.g. `$.get(foo)` */
			read: (id: Identifier) => Expression;
			/** turn `foo = bar` into e.g. `$.set(foo, bar)` */
			assign?: (node: Identifier, value: Expression, proxy?: boolean) => Expression;
			/** turn `foo.bar = baz` into e.g. `$.mutate(foo, $.get(foo).bar = baz);` */
			mutate?: (node: Identifier, mutation: AssignmentExpression | UpdateExpression) => Expression;
			/** turn `foo++` into e.g. `$.update(foo)` */
			update?: (node: UpdateExpression) => Expression;
		}
	>;
}

Frequently Asked Questions

What is the ClientTransformState type?
ClientTransformState is a type/interface in the svelte codebase, defined in packages/svelte/src/compiler/phases/3-transform/client/types.d.ts.
Where is ClientTransformState defined?
ClientTransformState is defined in packages/svelte/src/compiler/phases/3-transform/client/types.d.ts at line 17.

Analyze Your Own Codebase

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

Try Supermodel Free