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
It seems that using a single literal in an enums struct will not be interpreted by Describe properly when working with TS types that are literals. Is this the wrong usage of enums or describe? If not, I'm willing to submit a PR for this.
Reproduce
Here is a type which is a union of string literals (working).
For now, just use literal(). Maybe there should be a suggestion if you create an enums with only one value. Intuitively this to me feels like something that could be streamlined a bit. Is enums just an array of literals?
Description
It seems that using a single literal in an
enums
struct will not be interpreted byDescribe
properly when working with TS types that are literals. Is this the wrong usage ofenums
ordescribe
? If not, I'm willing to submit a PR for this.Reproduce
Here is a type which is a union of string literals (working).
However, when using
Describe
with a type which is a single string literal, there is an error.Error:
Using
Infer
This seems to work the other way when using
Infer
from a struct to generate a type. For example:Extra info:
Node:
v20.14.0
SuperStruct:
v1.0.4
I have
strict
enabled in my TypeScript configuration for these examples.I'm willing to submit a PR for this.
The text was updated successfully, but these errors were encountered: