Skip to content

Conversation

@kvz
Copy link
Member

@kvz kvz commented May 6, 2025

No description provided.

kvz and others added 4 commits May 6, 2025 21:31
* 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>
@kvz kvz merged commit 4b8944f into main May 7, 2025
8 checks passed
@kvz kvz deleted the sync-alphalib-2025-05-06 branch May 7, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants