react-native init test
npm install -g yarn
cd test
yarn android
react-native doctor
TypeScript가 동작할 수 있도록 필요한 라이브러리을 설치합니다.
npm install typescript @types/react @types/react-native --save-dev
typescript: TypeScript
@types/react: 필요한 react의 type
@types/react-native: 필요한 react-native의 type
tsconfig.json 생성
프로젝트 폴더에 tsconfig.json파일을 생성후 내용을 삽입
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react",
"lib": ["es6", "es2017"],
"moduleResolution": "node",
"noEmit": true,
"strict": true,
"target": "esnext",
"skipLibCheck": true
},
"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
}
TypeScript - tsconfig.json
TypeScript - compile options