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

Function formatTypeLiteral

packages/effect/src/SchemaAST.ts:1553–1568  ·  view source on GitHub ↗
(ast: TypeLiteral)

Source from the content-addressed store, hash-verified

1551const formatIndexSignatures = (iss: ReadonlyArray<IndexSignature>): string => iss.map(String).join("; ")
1552
1553const formatTypeLiteral = (ast: TypeLiteral): string => {
1554 if (ast.propertySignatures.length > 0) {
1555 const pss = ast.propertySignatures.map(String).join("; ")
1556 if (ast.indexSignatures.length > 0) {
1557 return `{ ${pss}; ${formatIndexSignatures(ast.indexSignatures)} }`
1558 } else {
1559 return `{ ${pss} }`
1560 }
1561 } else {
1562 if (ast.indexSignatures.length > 0) {
1563 return `{ ${formatIndexSignatures(ast.indexSignatures)} }`
1564 } else {
1565 return "{}"
1566 }
1567 }
1568}
1569
1570/**
1571 * @category guards

Callers 1

toStringMethod · 0.85

Calls 3

formatIndexSignaturesFunction · 0.85
joinMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected