migrate code to typescript