๐ŸšจType 'Set<string>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.๐Ÿšจ

ํ˜œํ˜œยท2023๋…„ 12์›” 17์ผ
0

Error Note

๋ชฉ๋ก ๋ณด๊ธฐ
15/19
post-custom-banner

โ—๋ฌธ์ œ ๋‚ด์šฉ

TypeScript์—์„œ Set๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ๋ฐœ์ƒํ•œ ์˜ค๋ฅ˜. Set์— ์ „๊ฐœ ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ–ˆ๋”๋‹ˆ ๋ฐœ์ƒํ–ˆ์—ˆ๊ณ , ์˜ค๋ฅ˜ ๋‚ด์šฉ์€ Set<string>์€ es2015 ๋ฒ„์ „ ์ด์ƒ์ผ ๋•Œ iterative ํ•˜๋‹ค๋Š” ์˜๋ฏธ์ธ ๊ฒƒ ๊ฐ™๋‹ค.

โš’๏ธ ๋ฌธ์ œ ํ•ด๊ฒฐ

{
  "compilerOptions": {
    "target": "es6",

๊ทธ๋ž˜์„œ tsconfig.json ํŒŒ์ผ์˜ compilerOptions target ๋ฒ„์ „์„ ๋ณ€๊ฒฝํ•ด์ฃผ๋ฉด ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ธฐ์กด ๋ฒ„์ „์€ es5 ์˜€๋Š”๋ฐ es2015(es6) ์ด์ƒ์˜ ๋ฒ„์ „์œผ๋กœ ์ˆ˜์ •ํ•ด์ฃผ๋ฉด ๋œ๋‹ค๊ณ  ๋‚˜์™€ ์žˆ์–ด์„œ es6์œผ๋กœ ์ˆ˜์ •ํ–ˆ๊ณ , ์•„๋‹ˆ๋ฉด ์ตœ์‹  ๋ฒ„์ „์ธ esnext๋กœ ์„ค์ •ํ•ด ์ค˜๋„ ๋  ๊ฒƒ ๊ฐ™๋‹ค. (๋‚˜์˜ ๊ฒฝ์šฐ์—๋Š” ํ˜ธํ™˜ ๋ฌธ์ œ๋กœ ์ผ๋‹จ es6์œผ๋กœ ์„ค์ •ํ–ˆ๋‹ค)

๐Ÿ™‡โ€โ™‚๏ธ ์ฐธ๊ณ ์ž๋ฃŒ

Type 'Set<unknown>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher

profile
์‰ฝ๊ฒŒ๋งŒ์‚ด์•„๊ฐ€๋ฉด์žฌ๋ฏธ์—†์–ด๋น™๊ณ 
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€