Generic Components #130
gaku-sei
started this conversation in
Language Development
Replies: 1 comment
-
This is something I'm thinking about lately as well.
This error is not on 0.5 but will be 0.6 so the example with the
Generics won't be implemented before 1.0 but planned after that in some way. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
According to this line: https://github.com/mint-lang/mint/blob/master/src/messages/property_not_hole.cr#L9, "type hole" or "generics" are not yet supported in properties (neither are they supported in records).
But they are "partly" supported in functions, since one can write:
This function is actually type safe, and Mint supports it nicely. But it gets more complex when you want to keep some generics consistency inside a component:
Will raise an error at runtime:
Uncaught TypeError: Cannot read property 'title' of undefined
.It could be solve by making components generics:
It would greatly improve the type safety!
Also, is there any plan to support "type holes/generics" in record and property before v1?
Beta Was this translation helpful? Give feedback.
All reactions