Is defining generics of a Component again when it's being used, really necessary in Flamework?

No description
Solution:
apparently you could do something like <A extends Attributes = {}, I extends Tool = Tool>...
Jump to solution
12 Replies
Tester
Tester•3mo ago
defining generics? wdym ohhh, i mean you could just create item that implements base components with set generics
class Item extends BaseComponent<IAttributesGeneric, IInstanceGeneric>
class Item extends BaseComponent<IAttributesGeneric, IInstanceGeneric>
generics are used only for guards so flamework can tell whether the instance is right and whether you have correct attributes
reimakesgames
reimakesgamesOP•3mo ago
I have to do it when defining fields though as seen in the image it's confusing If i don't provide those, it complains
Tester
Tester•3mo ago
hmm?
reimakesgames
reimakesgamesOP•3mo ago
No description
reimakesgames
reimakesgamesOP•3mo ago
forgot to add this image too oops
Tester
Tester•3mo ago
oh so you did baseclass?
Solution
Tester
Tester•3mo ago
apparently you could do something like <A extends Attributes = {}, I extends Tool = Tool>
reimakesgames
reimakesgamesOP•3mo ago
is that actually possible i don't think it is let me try real quick WHAT IT WORKS 😭
Tester
Tester•3mo ago
YAAAY :3
reimakesgames
reimakesgamesOP•3mo ago
I think the documentations need a bit of an update, but I'm not sure whether this is a typescript thing, or a flamework thing it was vague thank you
Tester
Tester•3mo ago
i think it's a typescript thing
reimakesgames
reimakesgamesOP•3mo ago
alright thanks

Did you find this page helpful?