(key: Key, value: Value)
| 9855 | * @category schemas |
| 9856 | * @since 4.0.0 |
| 9857 | */ |
| 9858 | export const StandardSchemaV1FailureResult: Struct<{ |
| 9859 | readonly issues: $Array< |
| 9860 | Struct<{ |
| 9861 | readonly message: String |
| 9862 | readonly path: optional< |
| 9863 | $Array< |
| 9864 | Union< |
| 9865 | readonly [ |
| 9866 | Union<readonly [Finite, Symbol, String]>, |
| 9867 | Struct<{ |
| 9868 | readonly key: Union<readonly [Finite, Symbol, String]> |
| 9869 | }> |
| 9870 | ] |
| 9871 | > |
| 9872 | > |
| 9873 | > |
| 9874 | }> |
| 9875 | > |
| 9876 | }> = Struct({ |
| 9877 | issues: ArraySchema(Struct({ |
| 9878 | message: String, |
| 9879 | path: optional(ArraySchema(Union([PropertyKey, Struct({ key: PropertyKey })]))) |
| 9880 | })) |
| 9881 | }) |
| 9882 | /** |
| 9883 | * Type-level representation of {@link BooleanFromBit}. |
| 9884 | * |
| 9885 | * @category models |
| 9886 | * @since 4.0.0 |
| 9887 | */ |
| 9888 | export interface BooleanFromBit extends decodeTo<Boolean, Literals<readonly [0, 1]>> { |
| 9889 | readonly "Rebuild": BooleanFromBit |
| 9890 | } |
| 9891 | /** |
| 9892 | * Schema for a boolean parsed from 0 or 1. |
| 9893 | * |
| 9894 | * **When to use** |
| 9895 | * |
| 9896 | * Use when decoding data sources that represent booleans as `0 | 1` while |
| 9897 | * keeping boolean values in the decoded model. |
| 9898 | * |
| 9899 | * **Details** |
| 9900 | * |
| 9901 | * Decoding accepts only `0 | 1`, maps `1` to `true`, and maps `0` to `false`. |
| 9902 | * Encoding maps `true` to `1` and `false` to `0`. |
| 9903 | * |
| 9904 | * @see {@link Boolean} for validating values that are already booleans |
| 9905 | * @see {@link Literals} for keeping bit literals instead of decoding them |
| 9906 | * |
| 9907 | * @category schemas |
| 9908 | * @since 4.0.0 |
| 9909 | */ |
| 9910 | export const BooleanFromBit: BooleanFromBit = Literals([0, 1]).pipe( |
| 9911 | decodeTo( |
| 9912 | Boolean, |
| 9913 | SchemaTransformation.transform({ |
| 9914 | decode: (bit) => bit === 1, |
nothing calls this directly
no test coverage detected
searching dependent graphs…