Result<T>A utility type to extract the result type from a Request.
Example (Extracting a request result type)
import type { Request } from "effect"
interface GetUser extends Request.Request<string, Error> {
readonly _tag: "GetUser"
readonly id: number
}
// Extract the result type from a Request using the utility
type UserResult = Request.Result<GetUser> // Exit.Exit<string, Error>utility types
Source effect/Request.ts:1942 lines
export type type Result<
T extends Request<any, any, any>
> = T extends Request<infer A, infer E, infer _R>
? Exit.Exit<A, E>
: never
A utility type to extract the result type from a Request.
Example (Extracting a request result type)
import type { Request } from "effect"
interface GetUser extends Request.Request<string, Error> {
readonly _tag: "GetUser"
readonly id: number
}
// Extract the result type from a Request using the utility
type UserResult = Request.Result<GetUser> // Exit.Exit<string, Error>
Result<function (type parameter) T in type Result<T extends Request<any, any, any>>T extends interface Request<out A, out E = never, out R = never>A Request<A, E, R> is a request from a data source for a value of type A
that may fail with an E and have requirements of type R.
Example (Defining typed requests)
import type { Request } from "effect"
// Define a request that fetches a user by ID
interface GetUser extends Request.Request<string, Error> {
readonly _tag: "GetUser"
readonly id: number
}
// Define a request that fetches all users
interface GetAllUsers extends Request.Request<ReadonlyArray<string>, Error> {
readonly _tag: "GetAllUsers"
}
Request<any, any, any>> = function (type parameter) T in type Result<T extends Request<any, any, any>>T extends interface Request<out A, out E = never, out R = never>A Request<A, E, R> is a request from a data source for a value of type A
that may fail with an E and have requirements of type R.
Example (Defining typed requests)
import type { Request } from "effect"
// Define a request that fetches a user by ID
interface GetUser extends Request.Request<string, Error> {
readonly _tag: "GetUser"
readonly id: number
}
// Define a request that fetches all users
interface GetAllUsers extends Request.Request<ReadonlyArray<string>, Error> {
readonly _tag: "GetAllUsers"
}
Request<infer function (type parameter) AA, infer function (type parameter) EE, infer function (type parameter) _R_R> ? import ExitExit.type Exit.Exit = /*unresolved*/ anyExit<function (type parameter) AA, function (type parameter) EE>
: neverReferenced by 4 symbols