-
If you don't have TypeScript installed in local project
- npx tsc fileName.ts
- This file gets converted to a JS file
- Before that happends, TS checkes file for errors
- Most errors will be seen in IDE before compilation
-
Typescript info
- Generic type only works in conjunction with another type (the connected type). You add the other type in the angle brackets
-
React with Typescript
- Typescript compilation will be part of build process for React (since react uses JSX which has to be converted to JS)
-
What to add types for in React
- Props
- If using arrow function to define component, you can also use the FC type.
- State
- Functions defined in your component