Don't Write Traditional Getter and Setter Methods in JavaScript and TypeScript
Effective TypeScript Blog
by
1M ago
Sun 31 December 2023 ) are common in Java and considered a best practice. But they're a code smell that's best avoided in JavaScript and TypeScript because the problem they solve in Java does not exist in JS/TS. This post looks at what that problem is and how you can solve it in TypeScript without imposing the boilerplate of getters and setters ..read more
Visit website
Effective TypeScript Talk at Etsy (Dec 2020)
Effective TypeScript Blog
by
1M ago
Back in 2020 I gave a whole series of talks at companies that were interested in the language and the book. The talk that I gave at Etsy in December of 2020 was one of the most fun. It was recorded and is now available to watch. It's about an hour ..read more
Visit website
The Hidden Side of Type Predicates
Effective TypeScript Blog
by
1M ago
Type guards are a powerful tool for improving TypeScript's built-in control flow analysis. This post looks at when it's appropriate to use a type predicate, and in particular what it means when a type predicate returns ..read more
Visit website
Know How to Iterate Over Objects
Effective TypeScript Blog
by
3M ago
Use Source Maps to Debug TypeScript ..read more
Visit website
Avoid Cluttering Your Code with Inferable Types
Effective TypeScript Blog
by
3M ago
Use Functional Constructs and Libraries to Help Types Flow Functions Instead of Callbacks for Asynchronous Code ..read more
Visit website
Using infer to unpack nested types
Effective TypeScript Blog
by
4M ago
Wed 29 November 2023 keyword can infer quite a bit more than you might expect. It's extremely effective at extracting types from the sort of nested structures that you might get from codegen or an API specification ..read more
Visit website
Overload on the type of this to specialize generics (The Lost Item)
Effective TypeScript Blog
by
5M ago
I cut one item from Effective TypeScript during the final stages of editing. Four years later, it's time for it to see the light of day! It's a trick for specializing generic types for certain subtypes of their type parameters. This post shows how it works, why it's indispensible for wrapper types, and also explains why I cut it from the book ..read more
Visit website
The Saga of the Closure Compiler, and Why TypeScript Won
Effective TypeScript Blog
by
7M ago
This post looks at the Closure Compiler, Google's tool from the mid-2000s for adding types to JavaScript. It looks at how its focus on minification led to very different design choices than TypeScript, and how this and a few other factors led to TypeScript becoming the ubiquitous solution for JavaScript + types. The Closure Compiler represents an alternative path that JavaScript could have taken, and it gives us perspective on TypeScript as it exists today ..read more
Visit website
TypeScript and SQL: Six Ways to Bridge the Divide
Effective TypeScript Blog
by
7M ago
If you develop server code with TypeScript, you'll inevitably come up against the question of how to interact with your database. There's lots of type information in your database (the structure of the tables) and it's not immediately clear how to share that type information between the DB and TypeScript. This post and its accompanying video present six ways to solve this problem and offer some advice gleaned from years of experience combining Postgres and TypeScript ..read more
Visit website
The display of types
Effective TypeScript Blog
by
9M ago
Let's dive in to the strange world of type display! our types. There are often several possible ways to display the same type, and the choice can have a big impact on the usability of your library. TypeScript tries to make good decisions on its own about type display, but it also gives us a few very obscure levers by which we can control it ourselves ..read more
Visit website

Follow Effective TypeScript Blog on FeedSpot

Continue with Google
Continue with Apple
OR