티스토리 뷰
에러 노트
[TS] 'food.ts' cannot be compiled under '--isolatedModules' because it is considered a global script file.
2021bong 2022. 11. 4. 00:41배열에 타입도 야무지게 선언해줬는데 왜 또 화를 내시는 겁니까 타선생님...😇
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[]) => {
...
}
728x90
'에러 노트' 카테고리의 다른 글
[Python] TypeError: 'float' object is not callable (0) | 2022.11.17 |
---|---|
[TS + HTML] Type 'number' is not assignable to type 'string'. (0) | 2022.11.08 |
[Python] /bin/sh: python: command not found vscode. (0) | 2022.10.21 |
[Vite] uncaught referenceerror process is not defined. (0) | 2022.10.21 |
[React] Warning: Received `false` for a non-boolean attribute `blink`. (0) | 2022.10.21 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 리액트
- 파이썬
- 저스트코드
- Til
- CSS
- 김버그
- 타입스크립트
- Typescript
- scss
- 드림코딩
- html
- 스파르타코딩클럽
- Python
- 코딩앙마
- 구름에듀
- vue
- React
- 깃
- 자바스크립트
- 제로초
- 제이쿼리
- 회고
- map
- javascript
- TS
- 비주얼스튜디오코드
- git
- 코드잇
- js
- vscode
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함