Skip to content

Commit e7e016f

Browse files
committed
Fixed #143, infinite deep type instantiation on message.
1 parent 42803a7 commit e7e016f

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Headlines: Added, Changed, Deprecated, Removed, Fixed, Security
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
- Fixed #143, infinite deep type instantiation on `message`. (Thanks to [thelinuxlich](https://github.com/thelinuxlich))
11+
812
## [1.0.0]
913

1014
### Added

src/lib/schemaEntity.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ export type ZodTypeInfo = {
3636
defaultValue: unknown;
3737
};
3838

39-
export type UnwrappedEntity<T> = T extends ZodOptional<infer U>
40-
? UnwrappedEntity<U>
41-
: T extends ZodDefault<infer U>
42-
? UnwrappedEntity<U>
43-
: T extends ZodNullable<infer U>
44-
? UnwrappedEntity<U>
45-
: T extends ZodEffects<infer U>
46-
? UnwrappedEntity<U>
47-
: T;
39+
export type UnwrappedEntity<T> = T extends infer R
40+
? R extends ZodOptional<infer U>
41+
? UnwrappedEntity<U>
42+
: R extends ZodDefault<infer U>
43+
? UnwrappedEntity<U>
44+
: R extends ZodNullable<infer U>
45+
? UnwrappedEntity<U>
46+
: R extends ZodEffects<infer U>
47+
? UnwrappedEntity<U>
48+
: R
49+
: never;
4850

4951
type EntityRecord<T extends AnyZodObject, K> = Record<keyof z.infer<T>, K>;
5052

0 commit comments

Comments
 (0)