How to create custom clone method for typescript class.
I'm trying to recreate the method, but cloning a typescript class instance instead of a roblox instance, I just can't figure out how to do it while keeping the methods and functionality the same.
I've tried: The spread operator ( ), copy/deepCopy from the object-utils package ( )
Intended behavior
9 Replies
Figured it out!
Here's my implementation
Some tests
It also works with classes which inherit it!
This does require the @rbxts/object-utils package though for the Object namespace
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Oh...
Oops!
MAKES SENSE
I overthought it
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Thanks 😔
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
Probably metatable stuff
Anyways
Solution
If anyone has this same issue just use
Thanks bitsplicer
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View