Skip to main content

Module: @ts-rest/core

Classes​

Interfaces​

Type Aliases​

And​

Ζ¬ And<B1, B2>: { false: { false: false ; true: false } ; true: { false: false ; true: true } }[`${B1}`][\`${B2}\`]

Type parameters​

NameType
B1extends boolean
B2extends boolean

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:153


ApiFetcher​

Ζ¬ ApiFetcher: (args: ApiFetcherArgs) => Promise<{ body: unknown ; headers: Headers ; status: number }>

Type declaration​

β–Έ (args): Promise<{ body: unknown ; headers: Headers ; status: number }>

Parameters​
NameType
argsApiFetcherArgs
Returns​

Promise<{ body: unknown ; headers: Headers ; status: number }>

Defined in​

libs/ts-rest/core/src/lib/client.ts:72


ApiFetcherArgs​

Ζ¬ ApiFetcherArgs: Object

Type declaration​

NameTypeDescription
bodyFormData | string | null | undefined-
cache?RequestCache-
contentTypeAppRouteMutation["contentType"]-
credentials?RequestCredentials-
headersRecord<string, string>-
methodstring-
next?NextClientArgs["next"]Only to be used by @ts-rest/next. You can obtain a Nextjs Client by calling initNextClient
pathstring-
rawBodyunknown-
rawQueryunknown-
routeAppRoute-
signal?AbortSignal-

Defined in​

libs/ts-rest/core/src/lib/client.ts:53


ApiResponseForRoute​

Ζ¬ ApiResponseForRoute<T>: ClientInferResponses<T>

Deprecated

Only safe to use on the client-side. Use ServerInferResponses/ClientInferResponses instead.

Type parameters​

NameType
Textends AppRoute

Defined in​

libs/ts-rest/core/src/lib/client.ts:25


AppRoute​

Ζ¬ AppRoute: AppRouteQuery | AppRouteMutation

A union of all possible endpoint types.

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:139


AppRouteFunction​

Ζ¬ AppRouteFunction<TRoute, TClientArgs, TArgs>: AreAllPropertiesOptional<TArgs> extends true ? (args?: Prettify<TArgs>) => Promise<Prettify<ClientInferResponses<TRoute>>> : (args: Prettify<TArgs>) => Promise<Prettify<ClientInferResponses<TRoute>>>

Returned from a mutation or query call

Type parameters​

NameType
TRouteextends AppRoute
TClientArgsextends ClientArgs
TArgsPartialClientInferRequest<TRoute, TClientArgs>

Defined in​

libs/ts-rest/core/src/lib/client.ts:37


AppRouteMutation​

Ζ¬ AppRouteMutation: AppRouteCommon & { body: ContractAnyType ; contentType?: "application/json" | "multipart/form-data" | "application/x-www-form-urlencoded" ; method: "POST" | "DELETE" | "PUT" | "PATCH" }

A mutation endpoint. In REST terms, one using POST, PUT, PATCH, or DELETE.

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:55


AppRouteQuery​

Ζ¬ AppRouteQuery: AppRouteCommon & { method: "GET" }

A query endpoint. In REST terms, one using GET.

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:47


AppRouteStrictStatusCodes​

Ζ¬ AppRouteStrictStatusCodes: Omit<AppRoute, "strictStatusCodes"> & { strictStatusCodes: true }

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:140


AppRouter​

Ζ¬ AppRouter: Object

A router (or contract) in @ts-rest is a collection of more routers or individual routes

Index signature​

β–ͺ [key: string]: AppRouter | AppRoute

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:148


AreAllPropertiesOptional​

Ζ¬ AreAllPropertiesOptional<T>: T extends Record<string, unknown> ? Exclude<keyof T, OptionalKeys<T>> extends never ? true : false : false

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:101


ClientInferRequest​

Ζ¬ ClientInferRequest<T, TClientArgs, Framework>: T extends AppRoute ? ClientInferRequestBase<Framework, T, TClientArgs> : T extends AppRouter ? { [TKey in keyof T]: ClientInferRequest<T[TKey]> } : never

Type parameters​

NameType
Textends AppRoute | AppRouter
TClientArgsextends Omit<ClientArgs, "baseUrl"> = { baseHeaders: {} }
Frameworkextends Frameworks = "none"

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:231


ClientInferResponseBody​

Ζ¬ ClientInferResponseBody<T, TStatus>: Prettify<AppRouteResponses<T, TStatus & HTTPStatusCode, "client">["body"]>

Type parameters​

NameType
Textends AppRoute
TStatusextends keyof T["responses"] = keyof T["responses"]

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:141


ClientInferResponses​

Ζ¬ ClientInferResponses<T, TStatus, TStrictStatusCodes>: T extends AppRoute ? Prettify<AppRouteResponses<T, TStatus, "client", TStrictStatusCodes>> : T extends AppRouter ? { [TKey in keyof T]: ClientInferResponses<T[TKey], TStatus, TStrictStatusCodes> } : never

Type parameters​

NameType
Textends AppRoute | AppRouter
TStatusextends HTTPStatusCode = HTTPStatusCode
TStrictStatusCodesextends "default" | "ignore" | "force" = "default"

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:120


ContractAnyType​

Ζ¬ ContractAnyType: z.ZodSchema | ContractPlainType<unknown> | ContractNullType | null

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:17


ContractNullType​

Ζ¬ ContractNullType: Opaque<typeof NullSymbol, "ContractNullType">

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:16


ContractOtherResponse​

Ζ¬ ContractOtherResponse<T>: Opaque<{ body: T ; contentType: string }, "ContractOtherResponse">

Type parameters​

NameType
Textends ContractAnyType

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:22


ContractPlainType​

Ζ¬ ContractPlainType<T>: Opaque<T, "ContractPlainType">

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:15


DefinedOrEmpty​

Ζ¬ DefinedOrEmpty<T, K>: undefined extends T ? {} : NonNullable<T>[K]

Type parameters​

NameType
TT
Kextends keyof NonNullable<T>

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:122


ErrorHttpStatusCode​

Ζ¬ ErrorHttpStatusCode: Exclude<HTTPStatusCode, SuccessfulHttpStatusCode>

Defined in​

libs/ts-rest/core/src/lib/status-codes.ts:72


Extends​

Ζ¬ Extends<T, U>: T extends U ? true : false

Type parameters​

Name
T
U

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:151


Frameworks​

Ζ¬ Frameworks: "nextjs" | "none"

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:27


GetFieldType​

Ζ¬ GetFieldType<T, P>: P extends `${infer Left}.${infer Right}` ? Left extends keyof T ? FieldWithPossiblyUndefined<T[Left], Right> : Left extends `${infer FieldKey}[${infer IndexKey}]` ? FieldKey extends keyof T ? FieldWithPossiblyUndefined<IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey>, Right> : undefined : undefined : P extends keyof T ? T[P] : P extends `${infer FieldKey}[${infer IndexKey}]` ? FieldKey extends keyof T ? IndexedFieldWithPossiblyUndefined<T[FieldKey], IndexKey> : undefined : undefined

Type parameters​

Name
T
P

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:22


HTTPStatusCode​

Ζ¬ HTTPStatusCode: 100 | 101 | 102 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511

All available HTTP Status codes

Defined in​

libs/ts-rest/core/src/lib/status-codes.ts:14


InitClientArgs​

Ζ¬ InitClientArgs: ClientArgs & { throwOnUnknownStatus?: boolean }

Defined in​

libs/ts-rest/core/src/lib/client.ts:351


InitClientReturn​

Ζ¬ InitClientReturn<T, TClientArgs>: RecursiveProxyObj<T, TClientArgs>

Type parameters​

NameType
Textends AppRouter
TClientArgsextends ClientArgs

Defined in​

libs/ts-rest/core/src/lib/client.ts:346


LowercaseKeys​

Ζ¬ LowercaseKeys<T>: Prettify<{ [K in keyof T as K extends string ? Lowercase<K> : K]: T[K] }>

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:147


Merge​

Ζ¬ Merge<T, U>: Omit<T, keyof U> & U

Type parameters​

Name
T
U

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:70


Narrow​

Ζ¬ Narrow<T>: Try<T, [], NarrowNotZod<T>>

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:85


NextClientArgs​

Ζ¬ NextClientArgs: Object

Type declaration​

NameType
next?{ revalidate?: number | false ; tags?: string[] }
next.revalidate?number | false
next.tags?string[]

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:29


Not​

Ζ¬ Not<B>: { false: true ; true: false }[`${B}`]

Type parameters​

NameType
Bextends boolean

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:175


Opaque​

Ζ¬ Opaque<Type, Token>: Type & Tagged<Token>

Type parameters​

NameType
TypeType
Tokenunknown

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:133


OptionalIfAllOptional​

Ζ¬ OptionalIfAllOptional<T, Select>: PartialBy<T, Select & { [K in keyof T]: AreAllPropertiesOptional<T[K]> extends true ? K : never }[keyof T]>

Type parameters​

NameType
TT
Selectextends keyof T = keyof T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:107


Or​

Ζ¬ Or<B1, B2>: { false: { false: false ; true: true } ; true: { false: true ; true: true } }[`${B1}`][\`${B2}\`]

Type parameters​

NameType
B1extends boolean
B2extends boolean

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:164


ParamsFromUrl​

Ζ¬ ParamsFromUrl<T>: RecursivelyExtractPathParams<T, {}> extends infer U ? { [key in keyof U]: U[key] } : never

Extract path params from path function

{ id: string, commentId: string }

Params

T - The URL e.g. /posts/:id

Type parameters​

NameType
Textends string

Defined in​

libs/ts-rest/core/src/lib/paths.ts:31


PartialBy​

Ζ¬ PartialBy<T, K>: Omit<T, K> & Partial<Pick<T, K>>

Type parameters​

NameType
TT
Kextends keyof T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:87


PartialByLooseKeys​

Ζ¬ PartialByLooseKeys<T, K>: Omit<T, K extends keyof T ? K : never> & Partial<Pick<T, K extends keyof T ? K : never>>

Type parameters​

Name
T
K

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:89


PartialClientInferRequest​

Ζ¬ PartialClientInferRequest<TRoute, TClientArgs, Framework>: OptionalIfAllOptional<ClientInferRequest<TRoute, TClientArgs, Framework>>

Type parameters​

NameType
TRouteextends AppRoute
TClientArgsextends Omit<ClientArgs, "baseUrl"> = { baseHeaders: {} }
Frameworkextends Frameworks = "none"

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:243


Prettify​

Ζ¬ Prettify<T>: { [K in keyof T]: T[K] } & {}

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:118


ResolveResponseType​

Ζ¬ ResolveResponseType<T>: T extends ContractOtherResponse<infer U> ? U : T

Type parameters​

NameType
Textends ContractAnyType | ContractOtherResponse<ContractAnyType>

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:63


RouterOptions​

Ζ¬ RouterOptions<TPrefix>: Object

Type parameters​

NameType
TPrefixextends string = string

Type declaration​

NameType
baseHeaders?unknown
pathPrefix?TPrefix
strictStatusCodes?boolean
validateResponseOnClient?boolean

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:152


ServerInferRequest​

Ζ¬ ServerInferRequest<T, TServerHeaders>: T extends AppRoute ? Prettify<Without<{ body: T extends AppRouteMutation ? BodyWithoutFileIfMultiPart<T> : never ; headers: "headers" extends keyof T ? Prettify<LowercaseKeys<ZodInferOrType<T["headers"]>> & [TServerHeaders] extends [never] ? {} : Omit<TServerHeaders, keyof LowercaseKeys<ZodInferOrType<T["headers"]>>>> : TServerHeaders ; params: [keyof PathParamsWithCustomValidators<T>] extends [never] ? never : Prettify<PathParamsWithCustomValidators<T>> ; query: "query" extends keyof T ? ZodInferOrType<T["query"]> : never }, never>> : T extends AppRouter ? { [TKey in keyof T]: ServerInferRequest<T[TKey], TServerHeaders> } : never

Type parameters​

NameType
Textends AppRoute | AppRouter
TServerHeadersnever

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:151


ServerInferResponseBody​

Ζ¬ ServerInferResponseBody<T, TStatus>: Prettify<AppRouteResponses<T, TStatus & HTTPStatusCode, "server">["body"]>

Type parameters​

NameType
Textends AppRoute
TStatusextends keyof T["responses"] = keyof T["responses"]

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:136


ServerInferResponses​

Ζ¬ ServerInferResponses<T, TStatus, TStrictStatusCodes>: T extends AppRoute ? Prettify<AppRouteResponses<T, TStatus, "server", TStrictStatusCodes>> : T extends AppRouter ? { [TKey in keyof T]: ServerInferResponses<T[TKey], TStatus, TStrictStatusCodes> } : never

Type parameters​

NameType
Textends AppRoute | AppRouter
TStatusextends HTTPStatusCode = HTTPStatusCode
TStrictStatusCodesextends "default" | "ignore" | "force" = "default"

Defined in​

libs/ts-rest/core/src/lib/infer-types.ts:104


SuccessfulHttpStatusCode​

Ζ¬ SuccessfulHttpStatusCode: 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207

Defined in​

libs/ts-rest/core/src/lib/status-codes.ts:1


UnwrapOpaque​

Ζ¬ UnwrapOpaque<OpaqueType>: OpaqueType extends Opaque<infer Type, OpaqueType[typeof tag]> ? Type : OpaqueType

Type parameters​

NameType
OpaqueTypeextends Tagged<unknown>

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:135


With​

Ζ¬ With<T, V>: Pick<T, ExcludeKeysWithoutTypeOf<T, V>>

Type parameters​

Name
T
V

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:52


Without​

Ζ¬ Without<T, V>: Pick<T, ExcludeKeysWithTypeOf<T, V>>

Type parameters​

Name
T
V

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:51


WithoutUnknown​

Ζ¬ WithoutUnknown<T>: Pick<T, { [K in keyof T]: unknown extends Exclude<T[K], undefined> ? never : K }[keyof T]>

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:140


ZodInferOrType​

Ζ¬ ZodInferOrType<T>: T extends ContractNullType ? null : T extends ContractPlainType<infer U> ? U : T extends z.ZodTypeAny ? z.infer<T> : T

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:54


ZodInputOrType​

Ζ¬ ZodInputOrType<T>: T extends ContractNullType ? null : T extends ContractPlainType<infer U> ? U : T extends z.ZodTypeAny ? z.input<T> : T

Type parameters​

Name
T

Defined in​

libs/ts-rest/core/src/lib/type-utils.ts:62

Variables​

ContractPlainTypeRuntimeSymbol​

β€’ Const ContractPlainTypeRuntimeSymbol: any

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:252

Functions​

checkZodSchema​

β–Έ checkZodSchema(data, schema, Β«destructuredΒ»?): { data: unknown ; success: true } | { error: ZodError<any> ; success: false }

Parameters​

NameType
dataunknown
schemaunknown
Β«destructuredΒ»Object
β€ΊΒ passThroughExtraKeysundefined | boolean

Returns​

{ data: unknown ; success: true } | { error: ZodError<any> ; success: false }

Defined in​

libs/ts-rest/core/src/lib/zod-utils.ts:57


convertQueryParamsToUrlString​

β–Έ convertQueryParamsToUrlString(query, json?): string

Parameters​

NameTypeDefault valueDescription
queryunknownundefinedAny JSON object
jsonbooleanfalseUse JSON.stringify to encode the query values

Returns​

string

  • The query url segment, using explode array syntax, and deep object syntax

Defined in​

libs/ts-rest/core/src/lib/query.ts:7


encodeQueryParams​

β–Έ encodeQueryParams(query): string

Parameters​

NameType
queryunknown

Returns​

string

Defined in​

libs/ts-rest/core/src/lib/query.ts:42


encodeQueryParamsJson​

β–Έ encodeQueryParamsJson(query): string

Parameters​

NameType
queryunknown

Returns​

string

Defined in​

libs/ts-rest/core/src/lib/query.ts:14


extractZodObjectShape​

β–Έ extractZodObjectShape<T>(obj): any

Type parameters​

NameType
Textends AnyZodObject | ZodEffects<ZodTypeAny, any, any>

Parameters​

NameType
objT

Returns​

any

Defined in​

libs/ts-rest/core/src/lib/zod-utils.ts:25


fetchApi​

β–Έ fetchApi(Β«destructuredΒ»): Promise<{ body: unknown ; headers: Headers ; status: number }>

Parameters​

NameTypeDescription
Β«destructuredΒ»Object-
β€ΊΒ bodyunknown-
β€ΊΒ clientArgsClientArgs-
β€ΊΒ extraInputArgsRecord<string, unknown>-
β€ΊΒ headersRecord<string, undefined | string>-
β€ΊΒ next?Objectonly to be used by @ts-rest/next You can obtain a Nextjs Client by calling initNextClient
β€ΊΒ next.revalidate?number | false-
β€ΊΒ next.tags?string[]-
β€ΊΒ pathstring-
β€ΊΒ queryunknown-
β€ΊΒ routeAppRoute-
β€ΊΒ signal?AbortSignal-

Returns​

Promise<{ body: unknown ; headers: Headers ; status: number }>

Defined in​

libs/ts-rest/core/src/lib/client.ts:167


getRouteQuery​

β–Έ getRouteQuery<TAppRoute, Framework>(route, clientArgs): (inputArgs?: Framework extends "nextjs" ? { body: any ; cache?: RequestCache ; extraHeaders?: {} & Record<string, undefined | string> ; headers: { [x: Lowercase<string>]: any; } ; next?: { revalidate?: number | false ; tags?: string[] } ; params: { [x: string]: any; } ; query: any } : { body: any ; cache?: RequestCache ; extraHeaders?: {} & Record<string, undefined | string> ; headers: { [x: Lowercase<string>]: any; } ; params: { [x: string]: any; } ; query: any }) => Promise<{ body: unknown ; headers: Headers ; status: number }>

Type parameters​

NameType
TAppRouteextends AppRoute
Frameworkextends Frameworks = "none"

Parameters​

NameType
routeTAppRoute
clientArgsInitClientArgs

Returns​

fn

β–Έ (inputArgs?): Promise<{ body: unknown ; headers: Headers ; status: number }>

Parameters​
NameType
inputArgs?Framework extends "nextjs" ? { body: any ; cache?: RequestCache ; extraHeaders?: {} & Record<string, undefined | string> ; headers: { [x: Lowercase<string>]: any; } ; next?: { revalidate?: number | false ; tags?: string[] } ; params: { [x: string]: any; } ; query: any } : { body: any ; cache?: RequestCache ; extraHeaders?: {} & Record<string, undefined | string> ; headers: { [x: Lowercase<string>]: any; } ; params: { [x: string]: any; } ; query: any }
Returns​

Promise<{ body: unknown ; headers: Headers ; status: number }>

Defined in​

libs/ts-rest/core/src/lib/client.ts:286


getRouteResponses​

β–Έ getRouteResponses<T>(router): ClientInferResponses<T>

Type parameters​

NameType
Textends AppRouter

Parameters​

NameType
routerT

Returns​

ClientInferResponses<T>

Deprecated

Only safe to use on the client-side. Use ServerInferResponses/ClientInferResponses instead.

Defined in​

libs/ts-rest/core/src/lib/client.ts:30


initClient​

β–Έ initClient<T, TClientArgs>(router, args): RecursiveProxyObj<T, TClientArgs>

Type parameters​

NameType
Textends AppRouter
TClientArgsextends InitClientArgs

Parameters​

NameType
routerT
argsTClientArgs

Returns​

RecursiveProxyObj<T, TClientArgs>

Defined in​

libs/ts-rest/core/src/lib/client.ts:359


initContract​

β–Έ initContract(): ContractInstance

Instantiate a ts-rest client, primarily to access router, response, and body

Returns​

ContractInstance

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:261


initTsRest​

β–Έ initTsRest(): ContractInstance

Returns​

ContractInstance

Deprecated

Please use initContract instead.

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:222


insertParamsIntoPath​

β–Έ insertParamsIntoPath<T>(Β«destructuredΒ»): string

Type parameters​

NameType
Textends string

Parameters​

NameType
Β«destructuredΒ»Object
β€ΊΒ paramsParamsFromUrl<T>
β€ΊΒ pathT

Returns​

string

  • The URL with the params e.g. /posts/123

Defined in​

libs/ts-rest/core/src/lib/paths.ts:45


isAppRoute​

β–Έ isAppRoute(obj): obj is AppRoute

Differentiate between a route and a router

Parameters​

NameType
objAppRoute | AppRouter

Returns​

obj is AppRoute

Defined in​

libs/ts-rest/core/src/lib/dsl.ts:165


isAppRouteOtherResponse​

β–Έ isAppRouteOtherResponse(response): response is ContractOtherResponse<ContractAnyType>

Parameters​

NameType
responseContractAnyType | ContractOtherResponse<ContractAnyType>

Returns​

response is ContractOtherResponse<ContractAnyType>

Defined in​

libs/ts-rest/core/src/lib/server.ts:17


isAppRouteResponse​

β–Έ isAppRouteResponse(value): value is Object

Parameters​

NameType
valueunknown

Returns​

value is Object

Defined in​

libs/ts-rest/core/src/lib/server.ts:6


isZodObject​

β–Έ isZodObject(obj): obj is AnyZodObject | ZodEffects<AnyZodObject, Object, Object>

Parameters​

NameType
objunknown

Returns​

obj is AnyZodObject | ZodEffects<AnyZodObject, Object, Object>

Defined in​

libs/ts-rest/core/src/lib/zod-utils.ts:7


isZodObjectStrict​

β–Έ isZodObjectStrict(obj): obj is AnyZodObject

Parameters​

NameType
objunknown

Returns​

obj is AnyZodObject

Defined in​

libs/ts-rest/core/src/lib/zod-utils.ts:21


isZodType​

β–Έ isZodType(obj): obj is ZodTypeAny

Parameters​

NameType
objunknown

Returns​

obj is ZodTypeAny

Defined in​

libs/ts-rest/core/src/lib/zod-utils.ts:3


parseJsonQueryObject​

β–Έ parseJsonQueryObject(query): Object

Parameters​

NameTypeDescription
queryRecord<string, string>A server-side query object where values have been encoded as JSON strings

Returns​

Object

  • The same object with the JSON strings decoded. Objects that were encoded using toJSON such as Dates will remain as strings

Defined in​

libs/ts-rest/core/src/lib/query.ts:100


tsRestFetchApi​

β–Έ tsRestFetchApi(args): Promise<{ body: unknown ; headers: Headers ; status: number }>

Default fetch api implementation:

Can be used as a reference for implementing your own fetcher, or used in the "api" field of ClientArgs to allow you to hook into the request to run custom logic

Parameters​

NameType
argsApiFetcherArgs

Returns​

Promise<{ body: unknown ; headers: Headers ; status: number }>

Defined in​

libs/ts-rest/core/src/lib/client.ts:72


validateResponse​

β–Έ validateResponse(Β«destructuredΒ»): Object

Parameters​

NameType
Β«destructuredΒ»Object
β€ΊΒ appRouteAppRoute
β€ΊΒ responseObject
β€ΊΒ response.body?unknown
β€ΊΒ response.statusnumber

Returns​

Object

NameType
body?unknown
statusnumber

Defined in​

libs/ts-rest/core/src/lib/server.ts:27


zodErrorResponse​

β–Έ zodErrorResponse(error): Pick<ZodError<any>, "name" | "issues">

Parameters​

NameType
errorZodError<any>

Returns​

Pick<ZodError<any>, "name" | "issues">

Defined in​

libs/ts-rest/core/src/lib/zod-utils.ts:96


zodMerge​

β–Έ zodMerge(objectA, objectB): Object

Parameters​

NameType
objectAunknown
objectBunknown

Returns​

Object

Defined in​

libs/ts-rest/core/src/lib/zod-utils.ts:41