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

Function typeMember

packages/effect/src/internal/schema/codeExpression.ts:51–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49 while (take("|") || take("&")) typeMember()
50 }
51 const typeMember = (): void => {
52 if (take("readonly") || take("typeof")) {
53 typeMember()
54 return
55 }
56 if (take("(")) {
57 type()
58 expect(")")
59 } else if (take("[")) {
60 list("]", () => {
61 take("...")
62 type()
63 take("?")
64 })
65 } else if (take("{")) {
66 while (!take("}")) {
67 take("readonly")
68 if (take("[")) {
69 if (tokens[index]?.kind === "identifier" && tokens[index + 1]?.text === ":") {
70 identifier()
71 expect(":")
72 type()
73 } else {
74 expression()
75 }
76 expect("]")
77 } else if (tokens[index]?.kind === "identifier" || isLiteral(tokens[index])) {
78 index++
79 } else {
80 fail()
81 }
82 take("?")
83 expect(":")
84 type()
85 if (!take(",") && !take(";") && !at("}")) fail()
86 }
87 } else if (take("-")) {
88 if (!isLiteral(tokens[index++])) fail()
89 } else if (isLiteral(tokens[index])) {
90 index++
91 } else {
92 path()
93 if (take("<")) list(">", type)
94 }
95 while (take("[")) expect("]")
96 }
97 const expression = (): void => {
98 if (take("-") || take("+") || take("!")) {
99 expression()

Callers 1

typeFunction · 0.85

Calls 10

expressionFunction · 0.85
isLiteralFunction · 0.85
takeFunction · 0.70
typeFunction · 0.70
expectFunction · 0.70
listFunction · 0.70
identifierFunction · 0.70
failFunction · 0.70
atFunction · 0.70
pathFunction · 0.70

Tested by

no test coverage detected