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

Function isSingleStringType

packages/platform/src/HttpApiBuilder.ts:599–624  ·  view source on GitHub ↗
(ast: AST.AST, key?: PropertyKey)

Source from the content-addressed store, hash-verified

597}
598
599function isSingleStringType(ast: AST.AST, key?: PropertyKey): boolean {
600 switch (ast._tag) {
601 case "StringKeyword":
602 case "Literal":
603 case "TemplateLiteral":
604 case "Enums":
605 return true
606 case "TypeLiteral": {
607 if (key !== undefined) {
608 const ps = ast.propertySignatures.find((ps) => ps.name === key)
609 return ps !== undefined
610 ? isSingleStringType(ps.type, key)
611 : ast.indexSignatures.some((is) => Schema.is(Schema.make(is.parameter))(key) && isSingleStringType(is.type))
612 }
613 return false
614 }
615 case "Union":
616 return ast.types.some((type) => isSingleStringType(type, key))
617 case "Suspend":
618 return isSingleStringType(ast.f(), key)
619 case "Refinement":
620 case "Transformation":
621 return isSingleStringType(ast.from, key)
622 }
623 return false
624}
625
626/**
627 * Normalizes the url parameters so that if a key is expected to be an array,

Callers 1

normalizeUrlParamsFunction · 0.85

Calls 3

isMethod · 0.65
makeMethod · 0.65
fMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…