Skip to main content

Default

Summary

Property decorator that supplies a fallback value when the environment variable is undefined or null.

Signature

Parameters

defaultValue

Type:unknown The value to use when the property is absent.

Returns

Type:PropertyDecorator Property decorator that supplies a fallback value when the environment variable is or .

Remarks

Pairs with class-transformer’s @Expose and class-validator decorators. The default is deep-cloned via JSON.parse(JSON.stringify(…)) so objects are not shared between instances.

Examples

Example 1