Home / Function/ constructor() — astro Function Reference

constructor() — astro Function Reference

Architecture documentation for the constructor() function in slots.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  4c536943_3ccc_52fe_8b35_0fb2704bccba["constructor()"]
  39243d9c_ec83_60a3_c7ca_6ad834992ebb["Slots"]
  4c536943_3ccc_52fe_8b35_0fb2704bccba -->|defined in| 39243d9c_ec83_60a3_c7ca_6ad834992ebb
  style 4c536943_3ccc_52fe_8b35_0fb2704bccba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/render/slots.ts lines 21–42

	constructor(result: SSRResult, slots: ComponentSlots | null, logger: Logger) {
		this.#result = result;
		this.#slots = slots;
		this.#logger = logger;

		if (slots) {
			for (const key of Object.keys(slots)) {
				if ((this as any)[key] !== undefined) {
					throw new AstroError({
						...AstroErrorData.ReservedSlotName,
						message: AstroErrorData.ReservedSlotName.message(key),
					});
				}
				Object.defineProperty(this, key, {
					get() {
						return true;
					},
					enumerable: true,
				});
			}
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the astro codebase, defined in packages/astro/src/core/render/slots.ts.
Where is constructor() defined?
constructor() is defined in packages/astro/src/core/render/slots.ts at line 21.

Analyze Your Own Codebase

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

Try Supermodel Free