Skip to content

Commit d3a74fe

Browse files
committed
feat: Remove unnecessary recursion
1 parent acddf0a commit d3a74fe

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

‎.changeset/nervous-pens-play.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ts-rest/core': patch
3+
---
4+
5+
Remove unnecessary recursion

‎libs/ts-rest/core/src/lib/dsl.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ type ContractInstance = {
6666
/**
6767
* A collection of routes or routers
6868
*/
69-
router: <T extends AppRouter>(endpoints: Narrow<T>) => Narrow<T>;
69+
router: <T extends AppRouter>(endpoints: Narrow<T>) => T;
7070
/**
7171
* A single query route, should exist within
7272
* a {@link AppRouter}
7373
*/
74-
query: <T extends AppRouteQuery>(query: Narrow<T>) => Narrow<T>;
74+
query: <T extends AppRouteQuery>(query: Narrow<T>) => T;
7575
/**
7676
* A single mutation route, should exist within
7777
* a {@link AppRouter}
7878
*/
79-
mutation: <T extends AppRouteMutation>(mutation: Narrow<T>) => Narrow<T>;
79+
mutation: <T extends AppRouteMutation>(mutation: Narrow<T>) => T;
8080
/**
8181
* Exists to allow storing a Type in the contract (at compile time only)
8282
*/
@@ -100,8 +100,11 @@ export const initTsRest = (): ContractInstance => initContract();
100100
*/
101101
export const initContract = (): ContractInstance => {
102102
return {
103+
// @ts-expect-error - this is a type error, but it's not clear how to fix it
103104
router: (args) => args,
105+
// @ts-expect-error - this is a type error, but it's not clear how to fix it
104106
query: (args) => args,
107+
// @ts-expect-error - this is a type error, but it's not clear how to fix it
105108
mutation: (args) => args,
106109
response: <T>() => undefined as unknown as T,
107110
body: <T>() => undefined as unknown as T,

0 commit comments

Comments
 (0)