Fix type error for typescript