(
{ failure, success }: {
readonly failure: E
readonly success: A
}
)
| 61 | * @category Stream |
| 62 | */ |
| 63 | export const Stream = <A extends Schema.Schema.Any, E extends Schema.Schema.All>( |
| 64 | { failure, success }: { |
| 65 | readonly failure: E |
| 66 | readonly success: A |
| 67 | } |
| 68 | ): Stream<A, E> => |
| 69 | Object.assign( |
| 70 | Schema.declare( |
| 71 | [success, failure], |
| 72 | { |
| 73 | decode: (success, failure) => |
| 74 | parseStream( |
| 75 | ParseResult.decodeUnknown(Schema.ChunkFromSelf(success)), |
| 76 | ParseResult.decodeUnknown(failure) |
| 77 | ), |
| 78 | encode: (success, failure) => |
| 79 | parseStream( |
| 80 | ParseResult.encodeUnknown(Schema.ChunkFromSelf(success)), |
| 81 | ParseResult.encodeUnknown(failure) |
| 82 | ) |
| 83 | }, |
| 84 | { |
| 85 | schemaId: StreamSchemaId, |
| 86 | [StreamSchemaId]: { success, failure } |
| 87 | } |
| 88 | ), |
| 89 | { |
| 90 | success, |
| 91 | failure |
| 92 | } |
| 93 | ) |
| 94 | |
| 95 | const isStream = (u: unknown): u is Stream_.Stream<unknown, unknown> => hasProperty(u, Stream_.StreamTypeId) |
| 96 |
nothing calls this directly
no test coverage detected