Commit 4160d1c
Fix deep types error (#227)
* Fix deep types error
One of the big features of TypeScript, is that it can infer types based
on context. This is powerful, but it comes at a cost. Determining types
based on inference consumes much more resources than using a type
annotation. This is an important reason to add explicit type
annotations.
We heavily rely on Zod though. Zod is powerful, but it heavily relies on
inference. This means that by using Zod, we sacrifice type checking
performance. Zod 4 will supposedly be more performant. This is great, but
by definition it can’t be as performant as regular types.
When the types become really complex, TypeScript may error on this. An
explicit type annotation in the right spot fixes this. This PR uses this
to resolve the type error. I can’t explain why this surfaced here, but
not in our internal repos these schemas originate from.
* Update src/alphalib/types/template.ts
---------
Co-authored-by: Kevin van Zonneveld <vanzonneveld@gmail.com>1 parent be42cc1 commit 4160d1c
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
0 commit comments