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

Function namesUndefined

packages/effect/src/ui/Query.ts:2415–2435  ·  view source on GitHub ↗
(
  ast: SchemaAST.AST,
  seen: Set<SchemaAST.AST> = new Set()
)

Source from the content-addressed store, hash-verified

2413 * since only its guard could say. A `suspend` is followed, once.
2414 */
2415const namesUndefined = (
2416 ast: SchemaAST.AST,
2417 seen: Set<SchemaAST.AST> = new Set()
2418): boolean => {
2419 switch (ast._tag) {
2420 case "Undefined":
2421 case "Void":
2422 case "Unknown":
2423 case "Any":
2424 return true
2425 case "Union":
2426 return ast.types.some((type) => namesUndefined(type, seen))
2427 case "Suspend": {
2428 if (seen.has(ast)) return false
2429 seen.add(ast)
2430 return namesUndefined(ast.thunk(), seen)
2431 }
2432 default:
2433 return false
2434 }
2435}
2436
2437/**
2438 * A copy of `o` without the named properties. Every other own property keeps

Callers 1

dropUndefinedOfFunction · 0.85

Calls 3

someMethod · 0.80
hasMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected