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

Function constructSync

packages/effect/src/SchemaParser.ts:1138–1151  ·  view source on GitHub ↗
(entry: CompilerRegistry.Entry, input: unknown, options: Schema.MakeOptions | undefined)

Source from the content-addressed store, hash-verified

1136}
1137
1138function constructSync<T>(entry: CompilerRegistry.Entry, input: unknown, options: Schema.MakeOptions | undefined): T {
1139 const parseOptions = constructorParseOptions(options)
1140 const make = CompilerRegistry.compilerAdaptersEnabled ? entry.make : undefined
1141 if (make !== undefined && input !== InternalParser.missing) {
1142 let output: unknown
1143 try {
1144 output = make(input, parseOptions)
1145 } catch (error) {
1146 throwConstructorDefect(error)
1147 }
1148 if (output !== CompilerRegistry.invalid && output !== InternalParser.missing) return output as T
1149 }
1150 return runSync(constructEffect<T>(entry, input, parseOptions), constructorDefectMessage)
1151}
1152
1153/**
1154 * Constructs a class instance from its type-side declaration.

Callers 2

makeConstructorSyncFunction · 0.85
makeClassSyncFunction · 0.85

Calls 5

constructorParseOptionsFunction · 0.85
throwConstructorDefectFunction · 0.85
constructEffectFunction · 0.85
makeFunction · 0.70
runSyncFunction · 0.70

Tested by

no test coverage detected