A practical guide to TypeScript decorators
LogRocket Blog » Typescript
by Rahman Fadhil
1M ago
Editor’s note: This article was last updated by Yan Sun on 21 March 2024 to provide information about parameter decorators in TypeScript, and explore advanced decorator patterns like decorator composition and factories. A decorator is a programming design pattern in which you wrap something to change its behavior. This feature is currently at stage three in JavaScript. Decorators are not new; several programming languages, such as Python, Java, and C#, adopted this pattern before JavaScript. Further refinement of the syntax will require feedback from implementation and users. At the time of w ..read more
Visit website
Exploring StyleX and the new generation of styling libraries
LogRocket Blog » Typescript
by Ibadehin Mojeed
2M ago
In the vast and dynamic world of web development, being ahead of the curve isn’t just an advantage —it’s essential. Over the years, CSS has evolved and continues to shape the visual landscape of the web. However, just like every technology, as CSS evolves, so do the tools at our disposal. In this guide, we’ll venture into the realm of styling libraries with a special focus on StyleX. We’ll cover what you need to know about StyleX, including its benefits and drawbacks, so you can decide if it is the right solution for you. You can check out the project code in this GitHub repo to see the code ..read more
Visit website
A guide to async/await in TypeScript
LogRocket Blog » Typescript
by Olasunkanmi John Ajiboye
2M ago
Editor’s note: This article was last updated by Oyinkansola Awosan on 15 February 2024 to include information about error handling with try/catch blocks and higher-order functions, as well as to feature TypeScript’s Awaited type. If you’re reading this blog, you probably have some familiarity with asynchronous programming in JavaScript, and you may be wondering how it works in TypeScript. Asynchronous programming is a way of writing code that can carry out tasks independently of each other, not needing one task to be completed before another gets started. When you think of asynchronous progra ..read more
Visit website
How to pass a TypeScript function as a parameter
LogRocket Blog » Typescript
by Kealan Parr
2M ago
Editor’s note: This article was last updated by Yan Sun on 6 February 2024. It now includes sections about declaring function types in TypeScript, using JavaScript’s passy-by-reference concept for functions, and understanding advanced patterns such as generics and function overloads. In JavaScript, functions are considered first-class citizens, which means they can be handled like any other type of variable, including numbers, strings, and arrays. This feature allows functions to be passed into other functions, returned from functions, and assigned to variables for later use. This feature is ..read more
Visit website
How to build a component library with React and TypeScript
LogRocket Blog » Typescript
by Yan Sun
2M ago
React has become a top choice for building web applications. It enables us to easily build reusable UI components. Meanwhile, TypeScript, a statically typed superset of JavaScript, brings type safety, enhancing both code quality and developer productivity. Component libraries are collections of pre-built, reusable, self-contained UI elements. These elements, often called components, encapsulate specific functionalities, making it easy to reuse them across different parts of an application or in multiple projects. This saves time and lets you avoid writing the same code over and over. In large ..read more
Visit website
Comparing TypeScript state management solutions
LogRocket Blog » Typescript
by Rashedul Alam
3M ago
State management in frontend development deals with maintaining the state or data knowledge across multiple application components. It’s an essential concept while working with frontend JavaScript and TypeScript frameworks and libraries, especially React, React Native, Vue, and Angular. Dealing with state management in TypeScript brings extra benefits, as TypeScript provides type safety. We can define types in each state management singleton and use the type definition with our modern code editors to show errors and write code with the correct syntax and format. Although most state management ..read more
Visit website
How to use type guards in TypeScript
LogRocket Blog » Typescript
by Oyinkansola Awosan
3M ago
Editor’s note: This article was last updated on 15 January 2024 to include the use of the TypeScript is operator. It also now covers the creation of custom type guards and information about how to inspect objects with type guards. A type guard is a TypeScript technique used to get information about the type of a variable, usually within a conditional block. Type guards are regular functions that return a Boolean, taking a type and telling TypeScript if it can be narrowed down to something more specific. Type guards have the unique property of assuring that the value tested is of a set type de ..read more
Visit website
How to use React Context with TypeScript
LogRocket Blog » Typescript
by Ibrahima Ndaw
3M ago
Editor’s note: This post was updated on 4 January 2024 to include information about implementing a React Context reducer with TypeScript and to introduce common issues that arise when using TypeScript with React Context, such as type assertion difficulties and enduring type safety in reducer functions. TypeScript has become increasingly popular after numerous improvements and additions were made to the code, such as robust static type checking, understandability, and type inferences. When TypeScript is used with React, it offers improved developer experience and more predictability to the pro ..read more
Visit website
Exploring Effect, a meta-state RxJS-like framework
LogRocket Blog » Typescript
by Isaac Okoro
3M ago
While TypeScript does a great job of statically typing JavaScript code, certain drawbacks might arise. These drawbacks can include managing the complex nature of asynchronous code, handling types in asynchronous scenarios, and error handling. The Effect library was created as a way to address these drawbacks. In this tutorial, we’ll get to know Effect, how it works, and why you may benefit from using it. We’ll also compare it to RxJS, a JavaScript library for reactive programming. What is Effect? Effect is a functional library for building and composing asynchronous, concurrent, and reactive ..read more
Visit website
Leveraging TypeScript for domain-driven design
LogRocket Blog » Typescript
by Matteo Di Pirro
4M ago
Domain-driven design (DDD) is a software development approach that aims to simplify the creation of applications that involve complex business logic. In this article, we’ll explore how to leverage TypeScript for DDD. TypeScript’s sophisticated type system enables fine-grained domain modeling and is highly adaptable, lending itself to complex app development. We’ll dive into the main principles and guidelines of domain-driven design, discuss how TypeScript can assist with DDD, and investigate if DDD can benefit frontend programming. We’ll also take a look at a domain-driven design example writ ..read more
Visit website

Follow LogRocket Blog » Typescript on FeedSpot

Continue with Google
Continue with Apple
OR