Services<T>A utility type to extract the requirements type from a Request.
utility types
Source effect/Request.ts:1712 lines
export type type Services<
T extends Request<any, any, any>
> = [T] extends [
Request<infer _A, infer _E, infer _R>
]
? _R
: never
A utility type to extract the requirements type from a Request.
Services<function (type parameter) T in type Services<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 Services<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) _A_A, infer function (type parameter) _E_E, infer function (type parameter) _R_R>] ? function (type parameter) _R_R
: neverReferenced by 2 symbols