처음 해보는 타입스크립트,...화이팅!
os는 mac 입니다!
cra를 이용해서 typescript 프로젝트 생성
npx create-react-app project-typescript --template typescript
// project-typescript부분은 프로젝트 이름으로, 원하는 이름으로 변경하여 작성
터미널에서 이런 명령어를 작성해준 후 [enter]를 눌러준 후
Success! Created typescript-test at [파일 경로]/project-typescript
Inside that directory, you can run several commands:
npm start
Starts the development server.
npm run build
Bundles the app into static files for production.
npm test
Starts the test runner.
npm run eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd typescript-test
npm start
Happy hacking!
이렇게 나오면 생성 성공!
주의할 점은 폴더 경로에 한글이 들어가면 나중에 사이드이펙트가 생길 수 있으니 왠만하면 영어로 만드는 것을 추천!
finder에서 경로 따라 들어가면

잘 만들어진 것을 볼 수 있음!
참고해준 블로그를 보면서 eslint와 prettier도 추가 해줌,
실행했는데
Error: "prettier/@typescript-eslint" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21
위의 에러가 발생!
해당 블로그는 2020년도라 지금은 prettier가 extend로 바뀌어서 .eslintrc에 있는 prettier extends를 제거 해줌!
module.exports = {
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
rules: {
// 추후 .prettierrc.js 파일에서 설정해줄 예정
},
settings: {
react: {
version: 'detect',
},
},
};
이렇게!
'DEVELOPMENT > WEB' 카테고리의 다른 글
| 아무도 안써줘서 내가 쓰는 채널톡 리액트에서 쉽게 커스텀하기 (0) | 2021.03.17 |
|---|---|
| [CSS/HTML]내가 가장 많이 사용하는 수평 수직 정렬 (0) | 2020.11.01 |

