Home / Function/ getEnvFieldType() — astro Function Reference

getEnvFieldType() — astro Function Reference

Architecture documentation for the getEnvFieldType() function in validators.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  2064a933_1fd5_4448_4233_38674c66fd82["getEnvFieldType()"]
  507d4b59_27b6_fc34_cbc8_02ec1d1596e5["validators.ts"]
  2064a933_1fd5_4448_4233_38674c66fd82 -->|defined in| 507d4b59_27b6_fc34_cbc8_02ec1d1596e5
  style 2064a933_1fd5_4448_4233_38674c66fd82 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/env/validators.ts lines 15–26

export function getEnvFieldType(options: EnvFieldType) {
	const optional = options.optional ? (options.default !== undefined ? false : true) : false;

	let type: string;
	if (options.type === 'enum') {
		type = options.values.map((v) => `'${v}'`).join(' | ');
	} else {
		type = options.type;
	}

	return `${type}${optional ? ' | undefined' : ''}`;
}

Domain

Subdomains

Frequently Asked Questions

What does getEnvFieldType() do?
getEnvFieldType() is a function in the astro codebase, defined in packages/astro/src/env/validators.ts.
Where is getEnvFieldType() defined?
getEnvFieldType() is defined in packages/astro/src/env/validators.ts at line 15.

Analyze Your Own Codebase

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

Try Supermodel Free