can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. 오류

광천·2023년 3월 24일
0

원인

//tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
  }
}

target은 타입스크립트 파일을 어떤 버전의 자바스크립트로 바꿔줄지 정하는 부분
es5로 셋팅해놓으면 es5 버전 자바스크립트로 컴파일(변환)

신버전을 원하면 es2016, esnext 이런 것도 입력할 수 있다.

해결

"compilerOptions": {
    "target": "esnext",
    }

출처

https://points.tistory.com/106
https://bum-developer.tistory.com/entry/TypeScript-%EC%BB%B4%ED%8C%8C%EC%9D%BC-%EC%8B%9C-%EC%84%B8%EB%B6%80-%EC%84%A4%EC%A0%95
https://codingapple.com/unit/typescript-tsconfig-json/

0개의 댓글