effect-io-ai

Package: effect
Module: Request

Request.of

Creates a constructor function for a specific Request type.

Example (Creating untagged request constructors)

import { Request } from "effect"

declare const UserProfile: unique symbol
declare const ProfileError: unique symbol
type UserProfile = typeof UserProfile
type ProfileError = typeof ProfileError

interface GetUserProfile extends Request.Request<UserProfile, ProfileError> {
  readonly id: string
  readonly includeSettings: boolean
}

const GetUserProfile = Request.of<GetUserProfile>()

const request = GetUserProfile({
  id: "user-123",
  includeSettings: true
})

Signature

declare const of: <R extends Request<any, any, any>>() => Constructor<R>

Source

Since v2.0.0