You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to define the same thing with superstruct, but I'm a bit lost as I can't reach the same definition.
Looking into the documentation didn't help me find other possible solutions, so here what I tried so far.
TS2322: Type Struct<string, null> is not assignable to type Describe<MyType>
Types of property TYPE are incompatible.
Type string is not assignable to type MyType
TS2322: Type Struct<string, null> is not assignable to type Describe<MyType>
Types of property TYPE are incompatible.
Type string is not assignable to type MyType
The text was updated successfully, but these errors were encountered:
To my understanding I don't think that there is a way in Superstruct to handle templated types like this. I also looked through the documentation and old issues to see if there was a discussion around this but couldn't find anything.
In terms of your examples, they all should work for validation but as I understand it you want the type inference off the struct. I don't think that is supported right now.
I currently have a type defined like this:
I'm trying to define the same thing with superstruct, but I'm a bit lost as I can't reach the same definition.
Looking into the documentation didn't help me find other possible solutions, so here what I tried so far.
Thanks in advance!
First try (enums)
I get
Second try (union and pattern)
I get
Third try (pattern)
I get
The text was updated successfully, but these errors were encountered: