VSCode에서 `.tsx` Typescript 파일을 열때 `Cannot use JSX unless the '--jsx' flag is provided` 에러가 뜨거나 `tsconfig` 파일에서 `argument for '--jsx' option must be: 'preserve', 'react-native', 'react'.`와 같은 에러가 뜨는 경우가 있다. 해당 에러는 VSCode에 TS 버전과 Global 환경에 설치된 TS버전이 달라서 발생한다. VSCode에서 TS 버전을 Global과 동일하게 맞춰주면 해결된다. 우선 Typescript가 설치되어 있는지 확인한다. ``` shell $ npm list -g typescript ``` 버전이 나온다면 설치가 된 것이고, 아니라면 Typescript를 설치해 준다. ``` shell $ npm i -g typescript ``` 이제 VSCode에 `setting.json` 파일을 열어서 Typescript 버전을 맞춰준다. ``` js // setting.json { "typescript.tsdk": "$GLOBAL_NPM_PATH/typescript/lib" } ``` Global NPM Path는 아래와 같은 명령어로 확인할 수 있다. ``` shell npm root -g ``` 해당 설정을 저장하고 VSCode를 다시 실행하면 정상 동적하는 것을 볼 수 있다.