Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
this is an old solution. It worked with 2.4/ES6, for example, but type constraints are now way tighter and it doesn't work anymore with 4.2, yes.
I think solutions to this example should try to make use of TS typecheck at compile time to get the intersecting types.
Like I tried here: https://www.codewars.com/kata/reviews/5916d24f81639e467a0009d8/groups/5e233520aa63470001e3ed38
I don't know if there is an Utility Type for that:
R extends { [K in keyof U]: K extends keyof T ? U[K] : never }
?Anyways it was fun trying to make it myself
This comment is hidden because it contains spoiler information about the solution
I'm not sure if the types of properties are rightly infered if you don't define them in Animal::constructor. At least my limited testing suggest it doesn't (they are all
any
).So you lose all typescript goodness with the parameters.