[TIL] cannot redeclare block-scoped variable (typescript)

Funnystyle·2021년 4월 16일
1

typescript 에서 const name 선언을 하면 에러가 발생한다.

cannot redeclare block-scoped variable 'name'

이 때 해결할 수 있는 방법은, 빈 object 를 export 해주면 됨.

export {};
const name = "Funny";

참고:
https://web.archive.org/web/20180609155906/http://fullstack-developer.academy/cannot-redeclare-block-scoped-variable-name/
https://stackoverflow.com/questions/35758584/cannot-redeclare-block-scoped-variable-typescript

profile
polyglot

0개의 댓글