MCPcopy
hub / github.com/Effect-TS/effect / go

Function go

packages/effect/src/SchemaAST.ts:2369–2401  ·  view source on GitHub ↗
(key: AST)

Source from the content-addressed store, hash-verified

2367 const propertySignatures: Array<PropertySignature> = []
2368 const indexSignatures: Array<IndexSignature> = []
2369 const go = (key: AST): void => {
2370 switch (key._tag) {
2371 case "NeverKeyword":
2372 break
2373 case "StringKeyword":
2374 case "SymbolKeyword":
2375 case "TemplateLiteral":
2376 case "Refinement":
2377 indexSignatures.push(new IndexSignature(key, value, true))
2378 break
2379 case "Literal":
2380 if (Predicate.isString(key.literal) || Predicate.isNumber(key.literal)) {
2381 propertySignatures.push(new PropertySignature(key.literal, value, false, true))
2382 } else {
2383 throw new Error(errors_.getASTUnsupportedLiteralErrorMessage(key.literal))
2384 }
2385 break
2386 case "Enums": {
2387 for (const [_, name] of key.enums) {
2388 propertySignatures.push(new PropertySignature(name, value, false, true))
2389 }
2390 break
2391 }
2392 case "UniqueSymbol":
2393 propertySignatures.push(new PropertySignature(key.symbol, value, false, true))
2394 break
2395 case "Union":
2396 key.types.forEach(go)
2397 break
2398 default:
2399 throw new Error(errors_.getASTUnsupportedKeySchemaErrorMessage(key))
2400 }
2401 }
2402 go(key)
2403 return { propertySignatures, indexSignatures }
2404}

Callers 6

recordFunction · 0.70
Pretty.tsFile · 0.70
Schema.tsFile · 0.70
makeLazyFunction · 0.70
Arbitrary.tsFile · 0.70
prettyFunction · 0.50

Calls

no outgoing calls

Tested by 1

prettyFunction · 0.40