What's the best way to attach functions to a TypeScript interface?
So I currently I have game objects with properties attached. For example, a creature card with properties attached. Now I have code like this:
I kinda hate this, especially if I have to write code like this all over the place.
Now ideally, I want to just put a predicate to the card so I implement it once and can just call
Is this possible with interfaces at all? Like an abstract prototype-ish implementation?
Some caveats:
I kinda hate this, especially if I have to write code like this all over the place.
Now ideally, I want to just put a predicate to the card so I implement it once and can just call
Is this possible with interfaces at all? Like an abstract prototype-ish implementation?
Some caveats:
- I cannot use classes, cause that messes up my Redux state management and jsonifying states in general.
- I also considered utility classes like
then I guess you could docardFunctions
not the biggest fan but if that's the best there is I might go for it