Fix bug in typescript