# Why typescript ## What problems do typscript solve ? In generic, **Typescript** is meant to loose type communication between javascript by build-time validations In the context of growing component driven ui and front-end libraries (.i.e React, Vue, etc) Typescript makes sure components are wired in right way. ### 1.Proptypes: Each component will need `props` from parent component to handle logic in it. Typescript makes sure right data is passed through props. Example : ![](https://i.imgur.com/yrQ4NeC.png) ### 2. Reusing components: Composing components will create necessity to understand both parent component and child component which might not be developed by same developer. Typescript will make it clear about usage of components by autocomplete and build time validations. Example: ![](https://i.imgur.com/e0L3wgw.png) ### 3. Data consuming : There are high chances of implementing static ui as per design and handed over to other developer to integrate real api. In this case typescript makes it clear to integrations about what data it needs to achieve speced out ui. Example : ![](https://i.imgur.com/DS9tZGO.png) ### 4. Thinking upfront in types: Types drived mental model combined with declarative though process will help to question and understand component behaviour before even writing code. ### 5. Ease of updating. Any update in requirement will demands change in types first.Once types are changed, components start warning and complaining about new changes. This makes easy to understand the impact of changes in existing code. ### 5. Ease of onboarding: Types declared with components and functions will start looking like documentation/usage-guidelines of each component. So any newly onboarded developer can understand current implementation. ### 6. Strong community drived ecosystem of tools: Tools like [graphql-code-generator](https://www.graphql-code-generator.com/docs/plugins/typescript-graphql-request) will streamline development with build-time advantage.