Typescript Features Over Javascript Substring Function