<< Previous Next >>

TypeScript Crash Course A hands-on guide to building safer and more reliable web applications (Daniel Cavalcante)(Z-Library)

Author: Daniel Cavalcante

Web Framework

Navigating the dynamic landscape of web development can be a daunting task, "TypeScript Crash Course" is a guide to help you on the journey of mastering TypeScript, one of today's most sought-after skills in the tech market. Starting from the basics and core principles to gradually building up to more advanced concepts, this book will help you move to practical examples of converting an application from JavaScript, React, and Node to TypeScript. This book also offers insights into leveraging TypeScript for both front-end and back-end development, ensuring readers can tackle any project with confidence, from development to deployment. This guide is not just about learning a new programming language; it is about enhancing your career in the tech industry by building more reliable applications. This book focuses on applying TypeScript in diverse practical scenarios to significantly shorten your learning curve. It also dispels common myths and misconceptions about TypeScript,... The Table of Contents serves only as an outline of the book because there are no page numbers. This copy seems to have been converted from an EPUB or similar format.

📄 File Format: PDF
💾 File Size: 2.4 MB
12
Views
0
Downloads
0.00
Total Donations

📄 Text Preview (First 20 pages)

ℹ️

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

📄 Page 1
(This page has no text content)
📄 Page 2
(This page has no text content)
📄 Page 3
TypeScript Crash Course A hands-on guide to building safer and more reliable web applications Daniel Cavalcante www.bpbonline.com
📄 Page 4
First Edition 2024 Copyright © BPB Publications, India ISBN: 978-93-55516-763 All Rights Reserved. No part of this publication may be reproduced, distributed or transmitted in any form or by any means or stored in a database or retrieval system, without the prior written permission of the publisher with the exception to the program listings which may be entered, stored and executed in a computer system, but they can not be reproduced by the means of publication, photocopy, recording, or by any electronic and mechanical means. LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY The information contained in this book is true to correct and the best of author’s and publisher’s knowledge. The author has made every effort to ensure the accuracy of these publications, but publisher cannot be held responsible for any loss or damage arising from any information in this book. All trademarks referred to in the book are acknowledged as properties of their respective owners but BPB Publications cannot guarantee the accuracy of this information. www.bpbonline.com
📄 Page 5
Dedicated to My amazing son Pedro and My supporting parents and family
📄 Page 6
About the Author Daniel Cavalcante has been working as a developer for more than 15 years. He has worked on Frontend, Backend, and mobile development for companies in Brazil, United States and Europe. He graduated from journalism and always aspired to be a writer, but his interest in technology and the web led to a career as a self-taught developer. Working with advertising agencies in São Paulo he has created websites and applications for companies like Johnnie Walker, Mattel, and large Brazilian brands like Sadia. He has been a speaker at conferences like React CWB. For the past years, he has been working remotely for companies like Osmosis, an American startup that was acquired by Elsevier, world's largest scientific publisher. Currently, he provides consultancy (and talks about technology) through his company Lightcode.
📄 Page 7
About the Reviewer Jahred Love has been a software engineer for nearly three decades. He has worked with some of the world's biggest and well-known companies, producing cutting-edge R&D. His most recent enterprise is Xirsys, which provides tools and software for real-time communication. Jahred is a leader in the field of WebRTC and currently heads the Voice Quality department for a well-known global telecommunications company.
📄 Page 8
Acknowledgement I am truly thankful for the unwavering support and encouragement from my parents, George and Noeme, and my son Pedro, for inspiring me to be more creative and bolder. I am also thankful to my siblings Marina, Carolina and David. I also extend my thanks to BPB Publications for their expert guidance and support in bringing this book to life. The process of textual and technical revision was a collaborative effort that enriched both the quality of this book and my technical knowledge. I also want to highlight the invaluable lessons and feedback from colleagues and collaborators that I have met in the tech industry. A shoutout to the team at Osmosis.org, especially the founder Shiv. He remains a friend and mentor who taught me a lot about expressing gratitude. Finally, my appreciation goes to all the readers who have shown an interest in my book. Your support makes this dream a reality and I hope it contributes to making your TypeScript journey more enjoyable!
📄 Page 9
Preface The immense popularity of the Web has hoisted JavaScript to the top of the most popular programming languages. From small websites to large-scale enterprise applications, the dynamic nature of JavaScript has challenged developers due to the unpredictability of increasingly larger codebases. Typescript has been established as the de facto solution to this problem, a statically typed superset that introduces type safety and powerful development tools. It is a layer of abstraction ultimately converted into JavaScript itself. This book will help you start developing enterprise-level applications using TypeScript, beginning with the basics, covering its syntax and key features such as types, interfaces, functions, and classes. Then, we explore more advanced topics including, how to work with modules, manage asynchronous code with promises and async/await, etc. Whether you are new to TypeScript and looking to understand its application in enterprise development, or an experienced developer aiming to enhance your skills in building scalable and maintainable applications, this book offers valuable knowledge and insights. By the end of this book, you will have a solid foundation in TypeScript and the skills necessary to tackle the challenges of enterprise application development head-on. Chapter 1: Introduction to TypeScript - This chapter serves as the starting point to learning TypeScript, a powerful extension of JavaScript that introduces types to
📄 Page 10
your code. It begins with the basics, outlining TypeScript's significance, and the advantages it brings to large-scale application development. Chapter 2: Installation and Setup – This chapter focuses on the initial steps required to integrate TypeScript into your development workflow, including the installation process across Windows, MacOS, and Linux. It covers setting up popular code editors to work seamlessly with TypeScript. We have laid a special emphasis on debugging techniques and the configuration of the TypeScript compiler for optimal development. This chapter ensures that you are well- prepared to write, debug, and compile TypeScript code efficiently. Chapter 3: TypeScript's Fundamentals – This chapter discusses the core concepts of TypeScript, providing a comprehensive overview of its syntax, type system, and the foundational knowledge necessary for effective coding. From basic syntax and type annotations to more intricate features like enums and tuples, this chapter builds a solid base for understanding how TypeScript enhances JavaScript by adding static types. Chapter 4: Structuring and Extending Types – This chapter explores the power of TypeScript's type system, focusing on creating and using interfaces, classes, and advanced types to build well-organized and maintainable code. This chapter discusses how TypeScript's type system allows for defining complex data structures, implementing inheritance and encapsulation with classes, and utilizing utility types for more flexible code Chapter 5: Working with Advanced TypeScript Features – This chapter unveils the more sophisticated aspects of TypeScript, including generics, decorators, and advanced type manipulation techniques such as mapped and conditional types. This chapter empowers readers to
📄 Page 11
leverage these advanced features to write highly reusable and flexible code. Through practical examples and in-depth explanations, readers will learn how to use generics to create highly adaptable functions and classes, decorators to add metadata and behavior to code, and advanced types for precise type transformations. Chapter 6: Migrating a JavaScript Web App to TypeScript – This chapter provides a step-by-step guide on transitioning an existing JavaScript application to TypeScript. Using a Todo List app as a practical example, this chapter walks through the process of converting JavaScript code to TypeScript, integrating third-party libraries, and addressing common challenges encountered during migration. Chapter 7: Adding TypeScript to a React Application – This chapter takes the principles of the Todo List app and applies them to a React application, demonstrating how to enhance a React project with TypeScript's static typing. This chapter covers setting up a React project with TypeScript, refactoring components to use TypeScript features, and addressing specific type challenges inherent in React development. Chapter 8: Using TypeScript with a Node.js Application – This chapter expands the application of TypeScript to server-side development with Node. This chapter outlines how to integrate TypeScript into a Node project, from setting up the development environment to converting an existing app to use TypeScript. Chapter 9: Building TypeScript for Production – This chapter focuses on the practical aspects of preparing a TypeScript project for production deployment. It covers topics such as optimizing TypeScript code for performance, setting up continuous integration and continuous deployment (CI/CD) pipelines, and managing dependencies. This chapter also explores using TypeScript with modern
📄 Page 12
tooling like bundlers and task runners, ensuring readers are equipped to deliver efficient, scalable, and maintainable TypeScript applications. Chapter 10: Best Practices and Next Steps – This chapter concludes the book by summarizing best practices for using TypeScript effectively and exploring pathways for further learning and mastery. This chapter emphasizes strategies for incremental adoption of TypeScript, tips for maintaining clean and type-safe code, and resources for continuing education in TypeScript and its ecosystem. By the end of this book, you will leave with a roadmap for advancing your TypeScript skills and integrating them into future projects.
📄 Page 13
Code Bundle and Coloured Images Please follow the link to download the Code Bundle and the Coloured Images of the book: https://rebrand.ly/9b2d9a The code bundle for the book is also hosted on GitHub at https://github.com/bpbpublications/TypeScript-Crash- Course. In case there’s an update to the code, it will be updated on the existing GitHub repository. We have code bundles from our rich catalogue of books and videos available at https://github.com/bpbpublications. Check them out! Errata We take immense pride in our work at BPB Publications and follow best practices to ensure the accuracy of our content to provide with an indulging reading experience to our subscribers. Our readers are our mirrors, and we use their inputs to reflect and improve upon human errors, if any, that may have occurred during the publishing processes involved. To let us maintain the quality and help us reach out to any readers who might be having difficulties due to any unforeseen errors, please write to us at : errata@bpbonline.com Your support, suggestions and feedbacks are highly appreciated by the BPB Publications’ Family.
📄 Page 14
Did you know that BPB offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.bpbonline.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at : business@bpbonline.com for more details. At www.bpbonline.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on BPB books and eBooks. Piracy If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at business@bpbonline.com with a link to the material. If you are interested in becoming an author If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit www.bpbonline.com. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Reviews Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions. We at BPB can understand what you think about our products, and our authors can see your feedback on their book. Thank you! For more information about BPB, please visit www.bpbonline.com. Join our book’s Discord space Join the book’s Discord Workspace for Latest updates, Offers, Tech happenings around the world, New Release and Sessions with the Authors: https://discord.bpbonline.com
📄 Page 15
(This page has no text content)
📄 Page 16
Table of Contents 1. Introduction to TypeScript Introduction Structure Objectives Introduction to TypeScript Brief overview of TypeScript The motivation behind creating TypeScript TypeScript's relationship with JavaScript Microsoft and TypeScript Visual Studio Code as a TypeScript editor The TypeScript ecosystem Plugins Libraries What is a type system and why it matters? Static and dynamic typing Static typing Dynamic typing Static versus dynamic typing Historical context and implications of JavaScript A Brief history of TypeScript TypeScript's key features Type annotation Compile-time type checking
📄 Page 17
Type inference Type erasure Other features Differences between TypeScript and JavaScript Performance implications and trade-offs Team collaboration benefits with TypeScript TypeScript's additional build and compilation steps Benefits of a type system in large-scale projects Better readability with type annotations and interfaces Maintainability benefits Early error detection through static typing Refactoring support and safe code modifications Encouraging best practices and design patterns Modular architecture and namespace organization Facilitating collaboration in large teams Supporting complex codebases and growing projects Autocompletion and IntelliSense in Visual Studio Code Additional benefits of using TypeScript Angular's adoption of TypeScript TypeScript support in React and other UI frameworks TypeScript support in Node.js Conclusion Points to remember 2. Installation and Setup Introduction Structure Objectives Installing TypeScript
📄 Page 18
Installation on Windows Installation on MacOS Installation on Linux Choosing a code editor Configuring your code editor for TypeScript Visual Studio Code (VSCode) WebStorm Sublime Text Atom Vim Emacs Debugging your TypeScript code Debugging in VSCode Debugging in other code editors and browsers Working with the TypeScript compiler Compiler configuration Common options for tsconfig.json Compiling TypeScript files Common compilation options Compiling TypeScript with popular frameworks Integration with React Integration with Vue Conclusion Points to remember 3. TypeScript's Fundamentals Introduction Structure Objectives Basic syntax and structure of TypeScript
📄 Page 19
Type annotations and type inference Type annotations Type inference When to use type annotations and type inference? Declaring variables and their types Variable declaration keywords Declaring without type annotations Declaring with type annotations Declaring multiple variables at once Optional type annotations Any type Primitive data types in TypeScript Number String Boolean Null and undefined Operators and expressions in TypeScript Control flow statements If/else statements Switch statements For/While loops Functions in TypeScript Defining functions Function parameters Return types First-Class Functions in TypeScript Function type definitions in TypeScript Arrays and tuples in TypeScript Arrays in TypeScript Tuples in TypeScript
📄 Page 20
Enums in TypeScript Conclusion Points to remember 4. Structuring and Extending Types Introduction Structure Objectives Role of type system in structuring and extending types Interfaces Interface basics Optional properties and methods in interfaces Extending interfaces Classes Class basics and constructors Inheritance in classes Encapsulation: private, public, and protected modifiers Public modifier Private modifier Protected modifier Type compatibility and coercion Type coercion and type assertions Covariance and contravariance in TypeScript Readonly and Partial types Readonly types Partial types Defining and using custom types Type aliases Union and intersection types
The above is a preview of the first 20 pages. Register to read the complete e-book.

💝 Support Author

0.00
Total Amount (¥)
0
Donation Count

Login to support the author

Login Now

Recommended for You

Loading recommended books...
Failed to load, please try again later
Back to List