Cannot redeclare block-scoped variable in TypeScript [Fixed]