I\'m having a fair amount of issues with this file migration to typescript, so overall would appreciate any feedback on what could be improved to make this more type safe and le