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

Function _is

packages/effect/src/SchemaParser.ts:153–163  ·  view source on GitHub ↗
(ast: SchemaAST.AST)

Source from the content-addressed store, hash-verified

151
152/** @internal */
153export function _is<T>(ast: SchemaAST.AST) {
154 const parser = asExit(run<T, never>(SchemaAST.toType(ast)))
155 return <I>(input: I): input is I & T => {
156 const exit = parser(input, SchemaAST.defaultParseOptions)
157 if (Exit.isSuccess(exit)) {
158 return true
159 }
160 InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, "Type guard adapter can only return false for schema issues")
161 return false
162 }
163}
164
165/** @internal */
166export function _issue<T>(ast: SchemaAST.AST) {

Callers 1

isFunction · 0.85

Calls 2

asExitFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected