Skip to content

Commit 0e65d00

Browse files
committed
fix(types): attempt to fix TypeScript infinite recursion
1 parent 65974a7 commit 0e65d00

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/key.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Static, TAnySchema, TSchema } from "@sinclair/typebox";
1+
import { Static, StaticDecode, TAnySchema, TSchema } from "@sinclair/typebox";
22
import { Decode, Encode } from "@sinclair/typebox/value";
33
import { RedisValue } from "./command";
44
import { RedisTransform } from "./transform";
@@ -11,9 +11,11 @@ export type TRedisHash<TValue extends TSchema = TAnySchema> = Record<
1111
/**
1212
* The value type of a Redis key that points to a primitive value or a hash map.
1313
*/
14-
export type Value<T extends TSchema | TRedisHash<TSchema>> = T extends TSchema
15-
? Static<T>
16-
: { [K in RedisField<T>]?: Value<T[K]> };
14+
export type Value<T extends TSchema | TRedisHash<TSchema>> = [T] extends [
15+
TSchema,
16+
]
17+
? StaticDecode<T>
18+
: { [K in RedisField<T>]?: StaticDecode<T[K]> };
1719

1820
/**
1921
* A field name of a Redis key that points to a hash map.

0 commit comments

Comments
 (0)