Skip to content

Commit 1f9fd4a

Browse files
authored
fix(core): fix types for TS 5.5 and no dom in tsconfig libs (#661)
1 parent 740c538 commit 1f9fd4a

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.changeset/dirty-students-tie.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+
Fix client functions resolving as `any` in TS 5.5 when `dom` is not included in tsconfig libs

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ export type GetFieldType<T, P> = P extends `${infer Left}.${infer Right}`
4141
// https://stackoverflow.com/questions/63447660/typescript-remove-all-properties-with-particular-type
4242
// Nested solution also available ^
4343
type ExcludeKeysWithTypeOf<T, V> = {
44-
[K in keyof T]-?: Exclude<T[K], undefined> extends V ? never : K;
44+
[K in keyof T]-?: [Exclude<T[K], undefined>] extends [V] ? never : K;
4545
}[keyof T];
4646

4747
type ExcludeKeysWithoutTypeOf<T, V> = {
48-
[K in keyof T]-?: Exclude<T[K], undefined> extends V ? K : never;
48+
[K in keyof T]-?: [Exclude<T[K], undefined>] extends [V] ? K : never;
4949
}[keyof T];
5050

5151
export type Without<T, V> = Pick<T, ExcludeKeysWithTypeOf<T, V>>;

0 commit comments

Comments
 (0)