enums gives relaxed type
See original GitHub issueconst struct = object({text: enums(["foo", "bar"])})
const {text} = create({ text: "foo"}, struct)
the text
variable is given a type of string
while I am expecting "foo" | "bar"
.
I can get around the problem with the more verbose union([literal("foo"), literal("bar")])
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Strongly-Typed Enums - ModernesCpp.com
Enumerations are a convenient way to define integer constants with names. These integer constants are called enumerators.
Read more >Enum vs Strongly typed enum - c++ - Stack Overflow
Scoped enums gives you the ability to specify the underlying type of the ... In <memory> : enum class pointer_safety { relaxed, preferred, ......
Read more >Handbook - Enums - TypeScript
String enums allow you to give a meaningful and readable value when your code runs, independent of the name of the enum member...
Read more >Enumeration declaration - cppreference.com
An enumeration has the same size, value representation, and alignment requirements as its underlying type.
Read more >Gson Advanced — Mapping of Enums - Future Studio
Java enums can be a very helpful data type. They limit the variable values to a predefined amount of constants. While this is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed and released in
0.16.3
! The generic type needed a little tweaking to preserve the more specific types instead of being expanded tostring
.Thanks so much!