( ast: A, defaultValue: Effect.Effect<unknown, SchemaIssue.Issue> )
| 3544 | |
| 3545 | /** @internal */ |
| 3546 | export function withConstructorDefault<A extends AST>( |
| 3547 | ast: A, |
| 3548 | defaultValue: Effect.Effect<unknown, SchemaIssue.Issue> |
| 3549 | ): A { |
| 3550 | const transformation = new SchemaTransformation.Transformation( |
| 3551 | SchemaGetter.withDefault(defaultValue), |
| 3552 | SchemaGetter.passthrough() |
| 3553 | ) |
| 3554 | const constructorDefault = new Link(unknown, transformation) |
| 3555 | const context = ast.context ? |
| 3556 | new Context(ast.context.isOptional, ast.context.isMutable, constructorDefault, ast.context.annotations) : |
| 3557 | new Context(false, false, constructorDefault) |
| 3558 | return replaceContext(ast, context) |
| 3559 | } |
| 3560 | |
| 3561 | /** |
| 3562 | * Attaches a `Transformation` to the `to` AST, making it decode from the |
nothing calls this directly
no test coverage detected