#3 TypeScript
#3.0 Introduction
const plus = (a, b) => a + b;
const a = 1;
const b = 'hi';
console.log(plus(a,b)) // 1hi;const plus = (a:number, b:number) => a + b;
const a = 1;
const b = 'hi';
console.log(plus(a+b)) // error !!#3.1 DefinitelyTyped
npm create-react-app my-app --template typescript // or yarn create react-app my-app --template typescriptnpm install --save typescript @types/node @types/react @types/react-dom @types/jest @types/style-components // ... 필요한 스크립트 추가 // or yarn add typescript @types/node @types/react @types/react-dom @types/jest @types/style-components
#3.2 Typing the Props
#3.3 Optional Props
#3.4 State
#3.5 Forms
#3.6 Themes
#3.7 Recap
Last updated