(pair: {
readonly key: KeySchema
readonly value: ValueSchema
})
| 367 | * data:** a missing field may be data corruption, not an old-shape |
| 368 | * document; silently substituting an empty map hides the problem. |
| 369 | * Prefer an explicit, preferably versioned migration over a |
| 370 | * decode-time fallback. See file-level note. |
| 371 | */ |
| 372 | withDecodingDefaultType: s.pipe(S.withDecodingDefaultType(Effect.sync(() => new Map()))) |
| 373 | }) |
| 374 | ) |
| 375 | |
| 376 | /** Like the default Schema `NullOr` but with default helpers. */ |
| 377 | export const NullOr = <Schema extends S.Top>(self: Schema) => |
| 378 | pipe( |
| 379 | S.NullOr(self), |
| 380 | (s) => |
| 381 | Object.assign(s, { |
| 382 | /** |
| 383 | * Construction-only default `null`. Applied only when the field is |
| 384 | * omitted from `.make(...)` input. NOT applied during decode — |
| 385 | * cannot be used to JIT-migrate database fields. See file-level |
| 386 | * note. |
| 387 | */ |
| 388 | withConstructorDefault: s.pipe(S.withConstructorDefault(Effect.succeed(null))), |
| 389 | /** |
| 390 | * Decode-time default `null`. **Discouraged for persisted data:** a |
| 391 | * missing field may be data corruption, not an old-shape document; |
| 392 | * silently substituting `null` hides the problem. Prefer an |
| 393 | * explicit, preferably versioned migration over a decode-time |
| 394 | * fallback. See file-level note. |
| 395 | */ |
| 396 | withDecodingDefaultType: s.pipe(S.withDecodingDefaultType(Effect.succeed(null))) |
nothing calls this directly
no test coverage detected
searching dependent graphs…