Type of field based on sibling
Hi all,
I'm trying to construct an interface for a constructor.
It would work like this:
where
i
= string.
In other words, I need to construct a generic signature like this.
but it doesn't work. Wondering if it's even possible...4 Replies
https://stackoverflow.com/questions/73413992/how-to-use-parameter-as-type-definition this seems to fit - although that instantiation looks sus
Stack Overflow
How to use parameter as type definition?
Is it possible to dynamically define a parameter type based on another parameter?
Like in the following scenario:
import z from 'zod'
// I have a function that defines a command factory with a build
That example is for two parameters, not fields on the same object
How about this?
Yep this worked great, thanks