refine ts code