Multiple Generics In Typescript Type
Building a library that lets you pull in all of your analytics events and make Typesafe queries of them, running into a problem with multiple generics
Events is a key, object pair which stores information about the events
Given above, the following should error in the second where since Answer Overflow Acount Id doesn't exist on autocapture, but since I can only do one generic it uses the combined type for both
7 Replies
The problem is with
I can't think of a way to make it do the generic on a per event basis, maybe I could do something with a builder pattern?
Source code also https://github.com/RhysSullivan/analytics-renderer
GitHub
GitHub - RhysSullivan/analytics-renderer
Contribute to RhysSullivan/analytics-renderer development by creating an account on GitHub.
Here's the events array:
Maybe a syntax like would work?
i realize now that this is literally just Drizzle for PostHog
This works but the types are wrong