how typescript works