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

Function lazilyMergeDefaults

packages/effect/src/Schema.ts:2848–2864  ·  view source on GitHub ↗
(
  fields: Struct.Fields,
  out: Record<PropertyKey, unknown>
)

Source from the content-addressed store, hash-verified

2846}
2847
2848const lazilyMergeDefaults = (
2849 fields: Struct.Fields,
2850 out: Record<PropertyKey, unknown>
2851): { [x: string | symbol]: unknown } => {
2852 const ownKeys = Reflect.ownKeys(fields)
2853 for (const key of ownKeys) {
2854 const field = fields[key]
2855 if (out[key] === undefined && isPropertySignature(field)) {
2856 const ast = field.ast
2857 const defaultValue = ast._tag === "PropertySignatureDeclaration" ? ast.defaultValue : ast.to.defaultValue
2858 if (defaultValue !== undefined) {
2859 out[key] = defaultValue()
2860 }
2861 }
2862 }
2863 return out
2864}
2865
2866function makeTypeLiteralClass<Fields extends Struct.Fields, const Records extends IndexSignature.Records>(
2867 fields: Fields,

Callers 1

TypeLiteralClassClass · 0.85

Calls 1

isPropertySignatureFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…