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

Function widenType

packages/effect/src/JsonSchema.ts:1013–1018  ·  view source on GitHub ↗
(node: Record<string, unknown>)

Source from the content-addressed store, hash-verified

1011}
1012
1013function widenType(node: Record<string, unknown>): Record<string, unknown> {
1014 const t = node.type
1015 if (typeof t === "string") return t === "null" ? node : { ...node, type: [t, "null"] }
1016 if (Array.isArray(t)) return t.includes("null") ? node : { ...node, type: [...t, "null"] }
1017 return node
1018}
1019
1020/**
1021 * Resolves a `$ref` string by looking up the last path segment in a

Callers 1

applyNullableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected