How do I type my component?

For instance if I have a model component, how can I type it so that I know it's children?
8 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
roblox-ts
roblox-ts3y ago
Playground link
Posted by <@281211788723486720>
PoppingPopper
PoppingPopperOP3y ago
That's so great! I think I misunderstand though. If I wanted to type the children of a BasePart I think it would go something like this
interface Attributes extends BasePart {
Sound: Sound;
}
interface Attributes extends BasePart {
Sound: Sound;
}
But I get an error when attempting to use it
const soundClone = this.instance.Sound.Clone(); //err: Property 'Sound' does not exist on type 'BasePart'
const soundClone = this.instance.Sound.Clone(); //err: Property 'Sound' does not exist on type 'BasePart'
Might also be my naïve TypeScript knowledge (sorry if I double pinged, I replied to the roblox-ts by accident) OH, it appears I was not asking for the .attributes of this I'll tinker a bit more. It worked! Thanks brotha
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
PoppingPopper
PoppingPopperOP3y ago
This is so lit, what an intuitive framework! Thanks for you help man
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
PoppingPopper
PoppingPopperOP3y ago
@trmcburger I can only do this with components though? Services are a different ball park?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?