create react app with typescript declare types for libraries in npm 1

create react app with typescript declare types for libraries in npm

for create-react-app put your types in  src/global.d.ts

Here is what the above code is Doing:
1. We’re importing the types we need from the React module.
2. We’re creating a type called AppProps that extends the React.Props type.
3. We’re creating a type called AppState that extends the React.State type.
4. We’re creating a class called App that extends the React.Component class.
5. We’re adding the AppProps and AppState types to the App class.
6. We’re adding a constructor to the App class.
7. We’re adding a render method to the App class.

Similar Posts