Home / Function/ warnForPropertyAccess() — astro Function Reference

warnForPropertyAccess() — astro Function Reference

Architecture documentation for the warnForPropertyAccess() function in runtime.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  871d315d_89b6_b15a_b2ea_2f875ce674b2["warnForPropertyAccess()"]
  73d13646_8e80_972f_3adc_f28448b64e4d["runtime.ts"]
  871d315d_89b6_b15a_b2ea_2f875ce674b2 -->|defined in| 73d13646_8e80_972f_3adc_f28448b64e4d
  502cda50_ba7d_1037_6310_4ddccd2d2939["createGetEntry()"]
  502cda50_ba7d_1037_6310_4ddccd2d2939 -->|calls| 871d315d_89b6_b15a_b2ea_2f875ce674b2
  style 871d315d_89b6_b15a_b2ea_2f875ce674b2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/runtime.ts lines 232–250

function warnForPropertyAccess(entry: object, prop: string, message: string) {
	// Skip if the property is already defined (it may be legitimately defined on the entry)
	if (!(prop in entry)) {
		let _value: any = undefined;
		Object.defineProperty(entry, prop, {
			get() {
				// If the user sets value themselves, don't warn
				if (_value === undefined) {
					console.error(message);
				}
				return _value;
			},
			set(v) {
				_value = v;
			},
			enumerable: false,
		});
	}
}

Subdomains

Called By

Frequently Asked Questions

What does warnForPropertyAccess() do?
warnForPropertyAccess() is a function in the astro codebase, defined in packages/astro/src/content/runtime.ts.
Where is warnForPropertyAccess() defined?
warnForPropertyAccess() is defined in packages/astro/src/content/runtime.ts at line 232.
What calls warnForPropertyAccess()?
warnForPropertyAccess() is called by 1 function(s): createGetEntry.

Analyze Your Own Codebase

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

Try Supermodel Free