MCPcopy Create free account
hub / github.com/Effect-TS/effect / annotateKey

Function annotateKey

packages/effect/src/SchemaAST.ts:3504–3514  ·  view source on GitHub ↗
(ast: A, annotations: Schema.Annotations.Key<unknown>)

Source from the content-addressed store, hash-verified

3502
3503/** @internal */
3504export function annotateKey<A extends AST>(ast: A, annotations: Schema.Annotations.Key<unknown>): A {
3505 const context = ast.context ?
3506 new Context(
3507 ast.context.isOptional,
3508 ast.context.isMutable,
3509 ast.context.constructorDefault,
3510 { ...ast.context.annotations, ...annotations }
3511 ) :
3512 new Context(false, false, undefined, annotations)
3513 return replaceContext(ast, context)
3514}
3515
3516/** @internal */
3517export const optionalKey: <A extends AST>(ast: A) => A = memoizeIdempotent(<A extends AST>(ast: A): A => {

Callers

nothing calls this directly

Calls 1

replaceContextFunction · 0.85

Tested by

no test coverage detected