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

Function projectType

packages/effect/src/SchemaAST.ts:4811–4824  ·  view source on GitHub ↗
(ast: A)

Source from the content-addressed store, hash-verified

4809}
4810
4811function projectType<A extends AST>(ast: A): A {
4812 const owned = projectOwner(ast, stripEncoding)
4813 if (owned) return owned
4814 if (isSuspend(ast)) return (flippedThunks.get(ast.thunk)?.project(ast) ?? ast.recur(stripEncoding)) as A
4815 const type = ("recur" in ast ? ast.recur(stripEncoding) : ast) as A
4816 if ("encodingChecks" in type && type.encodingChecks) {
4817 return copy(type, {
4818 encodingChecks: undefined,
4819 checks: combineChecks(projectChecks(ast, type.encodingChecks), type.checks)
4820 })
4821 }
4822 // A flipped declaration and its encoded projection need distinct reverse parsers.
4823 return type === ast && hasDirectionalParser(type) && flippedFrom.has(ast) ? copy(type, {}) : type
4824}
4825
4826/**
4827 * Returns the encoded (wire-format) AST by flipping and then stripping

Callers 1

stripEncodingFunction · 0.85

Calls 9

projectOwnerFunction · 0.85
projectChecksFunction · 0.85
hasDirectionalParserFunction · 0.85
copyFunction · 0.70
combineChecksFunction · 0.70
projectMethod · 0.65
getMethod · 0.65
recurMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected