(ast: A)
| 4809 | } |
| 4810 | |
| 4811 | function 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 |
no test coverage detected