Support more specific types on component interface fields
Opened this issue ยท 3 comments
TwitchBronBron commented
When we define component interfaces, we should support more specific types that can further improve the type system.
<component name="MyComponent">
<interface>
<field id="someNode" type="MAKE_ME_MORE_AWESOME" />
</interface>
</component>
- More specific component types instead of the generic
node
:
Instead of
<field id="someNode" type="node" />
We could support
<field id="someNode" type="roSGNodeContentNode" />
- enums instead of strings or integers
Instead of
<field id="someNode" type="SomeInterface" />
Could be
enum RemoteDirection
up="up
down="down"
end interface
<field id="direction" type="RemoteDirection" />
and much more. There are many edge cases to work out here. We could start with component types, and expand upon it later.
iBicha commented
Nice! A lot of options. I was thinking something way simpler though, and I just tried something and it worked!
<component name="MyComponent">
<interface>
<!-- someNode is supposed to be of type Label -->
<field id="label" type="node" />
</interface>
</component>
We can do something like
interface MyComponent extends roSGNodeMyComponent
label as roSGNodeLabel
end interface
And now I have a type that actually has better typing on the field
markwpearce commented
I think @TwitchBronBronโs idea is totally doable for v1.1 ๐
markwpearce commented
I really want this now. ๐
I may work on it if I have time.