Basically I'm having to do this:
const result = Result.deserialize<
Extract<typeof serialized, { status: "ok" }>["value"],
Extract<typeof serialized, { status: "error" }>["error"]
>(serialized);
But even here, because serialized is typed, we don't need to check Result shape and .
In fact ... what I want when my stack has the serialized shape is to just do this:
if (serialized.status === "ok") {
result = new Ok(serialized.value);
} else {
result = new Err(serialized.error);
}
So maybe I just want Result.fromSerialized or Result.new?
Basically I'm having to do this:
But even here, because
serializedis typed, we don't need to checkResultshape and .In fact ... what I want when my stack has the serialized shape is to just do this:
So maybe I just want
Result.fromSerializedorResult.new?