I have short example code placed on github (but it is too long to write it here). I found some workarounds that TS would not complain, but would like to get a professional help