Skip to main content

Module: @ts-rest/nest

Classes

Type Aliases

NestControllerContract

Ƭ NestControllerContract<T>: Pick<T, { [K in keyof T]-?: T[K] extends AppRoute ? K : never }[keyof T]>

Type parameters

NameType
Textends AppRouter

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest.ts:49


NestControllerInterface

Ƭ NestControllerInterface<T>: AppRouterControllerShape<T>

Type parameters

NameType
Textends AppRouter

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest.ts:55


NestRequestShapes

Ƭ NestRequestShapes<T>: AppRouterRequestShapes<T>

Type parameters

NameType
Textends AppRouter

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest.ts:57


NestResponseShapes

Ƭ NestResponseShapes<T>: AppRouterResponseShapes<T>

Type parameters

NameType
Textends AppRouter

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest.ts:58


TsRestOptions

Ƭ TsRestOptions: Object

Type declaration

NameType
jsonQuery?boolean
validateRequestBody?boolean
validateRequestHeaders?boolean
validateRequestQuery?boolean
validateResponses?boolean

Defined in

libs/ts-rest/nest/src/lib/ts-rest-options.ts:4


TsRestRequestShape

Ƭ TsRestRequestShape<TRoute>: ServerInferRequest<TRoute, Request["headers"]>

Type parameters

NameType
TRouteextends AppRoute

Defined in

libs/ts-rest/nest/src/lib/ts-rest-request.decorator.ts:24

Variables

RequestValidationErrorSchema

Const RequestValidationErrorSchema: ZodObject<{ bodyResult: ZodNullable<ZodObject<{ issues: ZodArray<ZodObject<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, "strip", ZodAny, objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">, objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">>, "many"> ; name: ZodLiteral<"ZodError"> }, "strip", ZodTypeAny, { issues: objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }, { issues: objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }>> ; headersResult: ZodNullable<ZodObject<{ issues: ZodArray<ZodObject<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, "strip", ZodAny, objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">, objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">>, "many"> ; name: ZodLiteral<"ZodError"> }, "strip", ZodTypeAny, { issues: objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }, { issues: objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }>> ; paramsResult: ZodNullable<ZodObject<{ issues: ZodArray<ZodObject<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, "strip", ZodAny, objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">, objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">>, "many"> ; name: ZodLiteral<"ZodError"> }, "strip", ZodTypeAny, { issues: objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }, { issues: objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }>> ; queryResult: ZodNullable<ZodObject<{ issues: ZodArray<ZodObject<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, "strip", ZodAny, objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">, objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">>, "many"> ; name: ZodLiteral<"ZodError"> }, "strip", ZodTypeAny, { issues: objectOutputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }, { issues: objectInputType<{ code: ZodNativeEnum<{ custom: "custom" ; invalid_arguments: "invalid_arguments" ; invalid_date: "invalid_date" ; invalid_enum_value: "invalid_enum_value" ; invalid_intersection_types: "invalid_intersection_types" ; invalid_literal: "invalid_literal" ; invalid_return_type: "invalid_return_type" ; invalid_string: "invalid_string" ; invalid_type: "invalid_type" ; invalid_union: "invalid_union" ; invalid_union_discriminator: "invalid_union_discriminator" ; not_finite: "not_finite" ; not_multiple_of: "not_multiple_of" ; too_big: "too_big" ; too_small: "too_small" ; unrecognized_keys: "unrecognized_keys" }> ; message: ZodOptional<ZodString> ; path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many"> }, ZodAny, "strip">[] ; name: "ZodError" }>> }, "strip", ZodTypeAny, { bodyResult: null | { name: "ZodError"; issues: objectOutputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } ; headersResult: null | { name: "ZodError"; issues: objectOutputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } ; paramsResult: null | { name: "ZodError"; issues: objectOutputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } ; queryResult: null | { name: "ZodError"; issues: objectOutputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } }, { bodyResult: null | { name: "ZodError"; issues: objectInputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } ; headersResult: null | { name: "ZodError"; issues: objectInputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } ; paramsResult: null | { name: "ZodError"; issues: objectInputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } ; queryResult: null | { name: "ZodError"; issues: objectInputType<{ path: ZodArray<ZodUnion<[ZodString, ZodNumber]>, "many">; message: ZodOptional<ZodString>; code: ZodNativeEnum<...>; }, ZodAny, "strip">[]; } }>

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest-handler.ts:67


TsRestAppRouteMetadataKey

Const TsRestAppRouteMetadataKey: typeof TsRestAppRouteMetadataKey

Defined in

libs/ts-rest/nest/src/lib/constants.ts:1


TsRestOptionsMetadataKey

Const TsRestOptionsMetadataKey: typeof TsRestOptionsMetadataKey

Defined in

libs/ts-rest/nest/src/lib/constants.ts:2

Functions

Api

Api(appRoute): MethodDecorator

Parameters

NameType
appRouteAppRoute

Returns

MethodDecorator

Deprecated

Use TsRest decorator instead

Defined in

libs/ts-rest/nest/src/lib/ts-rest.decorator.ts:73


ApiDecorator

ApiDecorator(): ParameterDecorator

Returns

ParameterDecorator

Deprecated

Use TsRestRequest instead

Defined in

libs/ts-rest/nest/src/lib/ts-rest-request.decorator.ts:99


TsRest

TsRest(appRoute, options?): MethodDecorator

As a class decorator, you can configure ts-rest options. As a method decorator, you can assign the route and also configure options

Parameters

NameTypeDescription
appRouteAppRoute-
options?TsRestOptionsFor a method decorator, this is the options

Returns

MethodDecorator

Defined in

libs/ts-rest/nest/src/lib/ts-rest.decorator.ts:20

TsRest(options): ClassDecorator

As a class decorator, you can configure ts-rest options. As a method decorator, you can assign the route and also configure options

Parameters

NameTypeDescription
optionsTsRestOptionsFor a method decorator, this is the options

Returns

ClassDecorator

Defined in

libs/ts-rest/nest/src/lib/ts-rest.decorator.ts:21


TsRestHandler

TsRestHandler(appRouterOrRoute, options?): MethodDecorator

Parameters

NameType
appRouterOrRouteAppRoute | AppRouter
options?TsRestOptions

Returns

MethodDecorator

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest-handler.ts:85


TsRestRequest

TsRestRequest(): ParameterDecorator

Parameter decorator used to parse, validate and return the typed request object

Returns

ParameterDecorator

Defined in

libs/ts-rest/nest/src/lib/ts-rest-request.decorator.ts:99


doesUrlMatchContractPath

doesUrlMatchContractPath(contractPath, url): boolean

Parameters

NameTypeDescription
contractPathstringExample ts '/posts/:id'
urlstringExample ts '/posts/1'

Returns

boolean

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest-handler.ts:174


initNestServer

initNestServer<T>(router): Object

Type parameters

NameType
Textends AppRouter

Parameters

NameType
routerT

Returns

Object

NameType
controllerShapeAppRouterControllerShape<T>
responseShapesAppRouterResponseShapes<T>
routeT
routeShapesAppRouterRequestShapes<T>

Deprecated

Use nestControllerContract, NestControllerInterface, NestRequestShapes, and NestResponseShapes instead

See

docs for more info.

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest.ts:40


nestControllerContract

nestControllerContract<T>(router): NestControllerContract<T>

Returns the contract containing only non-nested routes required by a NestJS controller

Type parameters

NameType
Textends AppRouter

Parameters

NameType
routerT

Returns

NestControllerContract<T>

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest.ts:64


tsRestHandler

tsRestHandler<T>(contract, implementation): NestHandlerImplementation<T>

Type parameters

NameType
Textends AppRoute | AppRouter

Parameters

NameTypeDescription
contractTThe contract or route to implement
implementationNestHandlerImplementation<T>Implementation of the route or entire contract as an object

Returns

NestHandlerImplementation<T>

Defined in

libs/ts-rest/nest/src/lib/ts-rest-nest-handler.ts:156