String literal types from typeof
is reduced to string
when passing through a generic function that "boxes" the type
#22758
Labels
Duplicate
An existing issue was already created
TypeScript Version: 2.7.2
Search Terms: string literal, typeof, generic, structuring, boxing
Code
Expected behavior:
A string literal type that was constructed from
typeof someVar | ...
should behave the same as a string literal type defined from string values'val' | ...
.Actual behavior:
When both passing through a generic function, AND structuring or "boxing" the type into an object or array, then the type is reduced to
string
.Playground Link: link to see inferred types
Related Issues:
unknown
The text was updated successfully, but these errors were encountered: