-
-
Notifications
You must be signed in to change notification settings - Fork 59
Support for Existential Type (*) #186
Comments
Looks good. But I want to add it as |
This feature is called |
@amatiasq not true "Existential Type" is completely different feature
"Existential Type" is way of writing incomplete type definition that acts as constraints for inference system |
I'm sorry I don't get what's const FEATURES: $Immutable<{
FILTERING: 'Filtering',
REORDERING: 'Reordering',
SORTING: 'Sorting'
}> = {
SORTING: 'Sorting',
FILTERING: 'Filtering',
REORDERING: 'Reordering'
} and const FEATURES: $Immutable<*> = {
SORTING: 'Sorting',
FILTERING: 'Filtering',
REORDERING: 'Reordering'
} Look to me like const FEATURES = {
SORTING: 'Sorting',
FILTERING: 'Filtering',
REORDERING: 'Reordering'
} as const I was looking for constant assertions when I found this issue should I create a different one then? |
@amatiasq this issue touches on same use case as |
supporting Existential Type will cut down boilerplate code that sometimes is needed to achieve same result for example
this
can be simplified to this
note: usage of
FEATURES
is same so i removed it in following snippetsso we say it will be Immutable but don't need to describe all properties and there values
there is two workarounds for this
one is to use
Object.freeze
and freeze object on runtime as wellsecond is to create helper
immutableId
function that will refine type but don't change value for runtimeThe text was updated successfully, but these errors were encountered: