-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prohibit undefined
in TypeScript Index Signatures for Data.Map
when key is String
#39
Comments
Hmm, the question mark was introduced in this commit: 64c03f3 It's been a while so I don't remember the context well. It makes sense that I tried removing it locally and the tests passed ¯\(ツ)/¯. Trying it in CI here. Before merging such a change I'd just want to think really hard and see if there's any way |
(Is there some situation where |
The commit comment says:
It sounds like string keys shouldn't ever cause this. I agree that it'd be great to not have the |
Thanks for
aeson-typescript
, it's great!Example
I've noticed that when using
Data.Map
as follows:(helper functions)
The generated types look like this:
It's a bit difficult to use these types, since indexing
IExample
will give anumber | undefined
value, even though the ToJSON instance forData.Map
should never includeundefined
values.Note that these errors still happen with
exactOptionalPropertyTypes
enabled.Desired Behavior
Instead, I would have expected the generated type to look more like this:
Questions
String
or an alias forString
?Related
microsoft/TypeScript#46969
The text was updated successfully, but these errors were encountered: