티스토리 뷰

배열에 타입도 야무지게 선언해줬는데 왜 또 화를 내시는 겁니까 타선생님...😇

const arr : string[] = ['string']

 

'food.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file. Add an import, export, or an empty 'export {}' statement to make it a module.


이유

ts파일에서 export를 해주지 않으면 타입스크립트는 화를 내는 것 같다.

 

아무것도 export하지 않는다면 이렇게 해주면 된다.

export {}

 

export를 해야하는 변수가 있다면 export를 붙여주면 된다.

...

export const handleFoodArr = (types: Types[]) => {
 ...
}

 

참고1

참고2

728x90
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함