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:157


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:89


ApiFetcherArgs​

Ζ¬ ApiFetcherArgs: Object

Type declaration​

NameTypeDescription
bodyFormData | URLSearchParams | string | null | undefined-
cache?RequestCacheDeprecated Use fetchOptions.cache instead
contentTypeAppRouteMutation["contentType"]-
credentials?RequestCredentialsDeprecated Use fetchOptions.credentials instead
fetchOptions?FetchOptions-
headersRecord<string, string>-
methodstring-
next?{ revalidate?: number | false ; tags?: string[] }Deprecated Use fetchOptions.next instead
next.revalidate?number | false-
next.tags?string[]-
pathstring-
rawBodyunknown-
rawQueryunknown-
routeAppRoute-
signal?AbortSignalDeprecated Use fetchOptions.signal instead
validateResponse?boolean-

Defined in​

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


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:153


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 | ContractNoBodyType ; 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:63


AppRouteQuery​

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

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

Defined in​

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


AppRouteResponse​

Ζ¬ AppRouteResponse: ContractAnyType | ContractNoBodyType | ContractOtherResponse<ContractAnyType>

Defined in​

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


AppRouteStrictStatusCodes​

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

Defined in​

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


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:162


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:105


ClientInferRequest​

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

Type parameters​

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

Defined in​

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


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:144


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:123


ContractAnyType​

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

Defined in​

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


ContractNoBodyType​

Ζ¬ ContractNoBodyType: typeof ContractNoBody

Defined in​

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


ContractNullType​

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

Defined in​

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


ContractOtherResponse​

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

Type parameters​

NameType
Textends ContractAnyType

Defined in​

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


ContractPlainType​

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

Type parameters​

Name
T

Defined in​

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


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:126


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:155


FetchOptions​

Ζ¬ FetchOptions: Omit<RequestInit, "method" | "headers" | "body">

Defined in​

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


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:380


InitClientReturn​

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

Type parameters​

NameType
Textends AppRouter
TClientArgsextends ClientArgs

Defined in​

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


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:151


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:74


Narrow​

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

Type parameters​

Name
T

Defined in​

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


Not​

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

Type parameters​

NameType
Bextends boolean

Defined in​

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


Opaque​

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

Type parameters​

NameType
TypeType
Tokenunknown

Defined in​

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


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:111


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:168


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:42


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:91


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:93


PartialClientInferRequest​

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

Type parameters​

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

Defined in​

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


Prettify​

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

Type parameters​

Name
T

Defined in​

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


ResolveResponseType​

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

Type parameters​

NameType
Textends ContractAnyType | ContractNoBodyType | 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​

NameTypeDescription
baseHeaders?unknown-
commonResponses?Record<number, AppRouteResponse>-
pathPrefix?TPrefix-
strictStatusCodes?boolean-
validateResponseOnClient?booleanDeprecated Use validateResponse on the client options

Defined in​

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


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:154


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:139


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:107


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:139


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:144


ZodInferOrType​

Ζ¬ ZodInferOrType<T>: T extends ContractNullType ? null : T extends ContractNoBodyType ? undefined : 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 ContractNoBodyType ? undefined : 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:64

Variables​

ContractNoBody​

β€’ Const ContractNoBody: typeof ContractNoBody

Defined in​

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


ContractPlainTypeRuntimeSymbol​

β€’ Const ContractPlainTypeRuntimeSymbol: any

Defined in​

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

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


evaluateFetchApiArgs​

β–Έ evaluateFetchApiArgs<TAppRoute>(route, clientArgs, inputArgs?): Object

Type parameters​

NameType
TAppRouteextends AppRoute

Parameters​

NameTypeDescription
routeTAppRoute-
clientArgsInitClientArgs-
inputArgs?Object-
inputArgs.bodyany-
inputArgs.cache?RequestCacheDeprecated Use fetchOptions.cache instead
inputArgs.extraHeaders?{} & Record<string, undefined | string>-
inputArgs.fetchOptions?FetchOptions-
inputArgs.headers{ [x: Lowercase<string>]: any; }-
inputArgs.overrideClientOptions?Partial<OverrideableClientArgs>-
inputArgs.params{ [x: string]: any; }-
inputArgs.queryany-

Returns​

Object

NameType
bodyunknown
clientArgsClientArgs
extraInputArgsRecord<string, unknown>
fetchOptions?FetchOptions
headersRecord<string, undefined | string>
pathstring
queryunknown
routeAppRoute

Defined in​

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


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​

NameType
Β«destructuredΒ»Object
β€ΊΒ bodyunknown
β€ΊΒ clientArgsClientArgs
β€ΊΒ extraInputArgsRecord<string, unknown>
β€ΊΒ fetchOptions?FetchOptions
β€ΊΒ headersRecord<string, undefined | string>
β€ΊΒ pathstring
β€ΊΒ queryunknown
β€ΊΒ routeAppRoute

Returns​

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

Defined in​

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


getRouteQuery​

β–Έ getRouteQuery<TAppRoute>(route, clientArgs): (inputArgs?: { body: any ; cache?: RequestCache ; extraHeaders?: {} & Record<string, undefined | string> ; fetchOptions?: FetchOptions ; headers: { [x: Lowercase<string>]: any; } ; overrideClientOptions?: Partial<OverrideableClientArgs> ; params: { [x: string]: any; } ; query: any }) => Promise<{ body: unknown ; headers: Headers ; status: number }>

Type parameters​

NameType
TAppRouteextends AppRoute

Parameters​

NameType
routeTAppRoute
clientArgsInitClientArgs

Returns​

fn

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

Parameters​
NameTypeDescription
inputArgs?Object-
inputArgs.bodyany-
inputArgs.cache?RequestCacheDeprecated Use fetchOptions.cache instead
inputArgs.extraHeaders?{} & Record<string, undefined | string>-
inputArgs.fetchOptions?FetchOptions-
inputArgs.headers{ [x: Lowercase<string>]: any; }-
inputArgs.overrideClientOptions?Partial<OverrideableClientArgs>-
inputArgs.params{ [x: string]: any; }-
inputArgs.queryany-
Returns​

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

Defined in​

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


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:388


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:294


initTsRest​

β–Έ initTsRest(): ContractInstance

Returns​

ContractInstance

Deprecated

Please use initContract instead.

Defined in​

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


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:56


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:184


isAppRouteNoBody​

β–Έ isAppRouteNoBody(response): response is typeof ContractNoBody

Parameters​

NameType
responsetypeof ContractNoBody | ContractAnyType | ContractOtherResponse<ContractAnyType>

Returns​

response is typeof ContractNoBody

Defined in​

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


isAppRouteOtherResponse​

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

Parameters​

NameType
responsetypeof ContractNoBody | ContractAnyType | ContractOtherResponse<ContractAnyType>

Returns​

response is ContractOtherResponse<ContractAnyType>

Defined in​

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


isAppRouteResponse​

β–Έ isAppRouteResponse(value): value is Object

Parameters​

NameType
valueunknown

Returns​

value is Object

Defined in​

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


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:89


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:45


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