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

Function annotate

packages/effect/src/SchemaAST.ts:3375–3383  ·  view source on GitHub ↗
(ast: A, annotations: Schema.Annotations.Annotations)

Source from the content-addressed store, hash-verified

3373
3374/** @internal */
3375export function annotate<A extends AST>(ast: A, annotations: Schema.Annotations.Annotations): A {
3376 if (ast.checks) {
3377 const last = ast.checks[ast.checks.length - 1]
3378 return replaceChecks(ast, Arr.append(ast.checks.slice(0, -1), last.annotate(annotations)))
3379 }
3380 return modifyOwnPropertyDescriptors(ast, (d) => {
3381 d.annotations.value = { ...d.annotations.value, ...annotations }
3382 })
3383}
3384
3385/** @internal */
3386export function replaceChecks<A extends AST>(ast: A, checks: Checks | undefined): A {

Callers 2

brandFunction · 0.70
SchemaAST.tsFile · 0.70

Calls 3

replaceChecksFunction · 0.85
annotateMethod · 0.65

Tested by

no test coverage detected