MCPcopy Index your code
hub / github.com/Effect-TS/effect / getNumberIndexedAccess

Function getNumberIndexedAccess

packages/effect/src/SchemaAST.ts:2241–2266  ·  view source on GitHub ↗
(ast: AST)

Source from the content-addressed store, hash-verified

2239
2240/** @internal */
2241export const getNumberIndexedAccess = (ast: AST): AST => {
2242 switch (ast._tag) {
2243 case "TupleType": {
2244 let hasOptional = false
2245 let out: Array<AST> = []
2246 for (const e of ast.elements) {
2247 if (e.isOptional) {
2248 hasOptional = true
2249 }
2250 out.push(e.type)
2251 }
2252 if (hasOptional) {
2253 out.push(undefinedKeyword)
2254 }
2255 out = out.concat(getRestASTs(ast.rest))
2256 return Union.make(out)
2257 }
2258 case "Refinement":
2259 return getNumberIndexedAccess(ast.from)
2260 case "Union":
2261 return Union.make(ast.types.map(getNumberIndexedAccess))
2262 case "Suspend":
2263 return getNumberIndexedAccess(ast.f())
2264 }
2265 throw new Error(errors_.getASTUnsupportedSchemaErrorMessage(ast))
2266}
2267
2268const getTypeLiteralPropertySignature = (ast: TypeLiteral, name: PropertyKey): PropertySignature | undefined => {
2269 // from property signatures...

Callers

nothing calls this directly

Calls 4

getRestASTsFunction · 0.85
makeMethod · 0.65
mapMethod · 0.65
fMethod · 0.65

Tested by

no test coverage detected