News
Entertainment
Science & Technology
Life
Culture & Art
Hobbies
News
Entertainment
Science & Technology
Culture & Art
Hobbies
Roughly, TypeScript is JavaScript plus type information. The latter is removed before TypeScript code is executed by JavaScript engines. Therefore, writing and deploying TypeScript is more work. Is that added work worth it? In this blog post, I’m going to argue that yes, it is. Read it if you are skeptical about TypeScript but interested in giving it a chance.
Read this blog post if you are a JavaScript programmer and want to get a rough idea of what using TypeScript is like (think first step before learning more details). You’ll get answers to the following questions: How is TypeScript code different from JavaScript code? How is TypeScript code run? How does TypeScript help during editing in an IDE? Etc. Note: This blog post does not explain why TypeScript is useful. If you want to know more about that, you can read my TypeScript sales pitch.
The TypeScript handbook makes an interesting statement: “Often, the checks in a conditional type will provide us with some new information. Just like narrowing with type guards can give us a more specific type, the true branch of a conditional type will further constrain generics by the type we check against.” In this blog post, we’ll see that this goes further than you may think.
In TypeScript, conditional types let us make decisions (think if-then-else expressions) – which is especially useful in generic types. They are also an essential tool for working with union types because they let use “loop” over them. Read on if you want to know how all of that works.
A mapped type is a loop over keys that produces an object or tuple type and looks as follows: {[PropKey in PropKeyUnion]: PropValue} In this blog post, we examine how mapped types work and see examples of using them. Their most importing use cases are transforming objects and mapping tuples.
In this blog post, we explore how we can extract parts of composite types via the infer operator. It helps if you are loosely familiar with conditional types. You can check out section “Conditional types” in “Tackling TypeScript” to read up on them.
JavaScript’s Arrays are so flexible that TypeScript provides two different kinds of types for handling them: Array types for arbitrary-length sequences of values that all have the same type – e.g.: Array<string> Tuple types for fixed-length sequences of values where each one may have a different type – e.g.: [number, string, boolean] In this blog post, we look at the latter – especially how to compute with tuples at the type level.
In this blog post, we take a closer look at template literal types in TypeScript: While their syntax is similar to JavaScript’s template literals, they operate at the type level. Their use cases include: Static syntax checking for string literals Transforming the casing of property names (e.g. from hyphen case to camel case) Concisely specifying large string literal union types
The ECMAScript proposal “RegExp escaping” (by Jordan Harband and Kevin Gibbons) specifies a function RegExp.escape() that, given a string text, creates an escaped version that matches text – if interpreted as a regular expression. This proposal is currently at stage 3.
In order to feel more confident about my tsconfig.json, I decided to go through the tsconfig.json documentation, collect the most important options and describe them below: You can come along for the whole ride. Or you can skip ahead to the summary at the end. I also list recommendations for tsconfig.json by several other people. I’m curious what your experiences with tsconfig.json are: Do you agree with my recommendations? Did I miss anything?
Traditionally, we could only apply regular expression flags such as i (for ignoring case) to all of a regular expression. The ECMAScript feature “Regular Expression Pattern Modifiers” (by Ron Buckton) enables us to apply them to only part of a regular expression. In this blog post we examine how they work and what their use cases are. Regular expression pattern modifiers attributes reached stage 4 in October 2024 and will probably be part of ECMAScript 2025.
The ECMAScript feature “Import Attributes” (by Sven Sauleau, Daniel Ehrenberg, Myles Borins, Dan Clark and Nicolò Ribaudo) helps with importing artifacts other than JavaScript modules. In this blog post, we examine what that looks like and why it’s useful. Import attributes reached stage 4 in October 2024 and will probably be part of ECMAScript 2025.
As a web developer, I love Mastodon: Since Twitter became X, there are enough web dev people here. I’m happy with the web app – it even has several nice touches where it is better than Twitter. I’m not locked into an ecosystem that is controlled by a single company. That being said, Mastodon still has several major weaknesses. In this blog post, I collect those and explain what’s being done to fix them. It is not meant to be exhaustive: If there is a weakness that affects you and isn’t mentioned here, then please let us know in the comments.
In this blog post, we examine ArrayBuffer features that were introduced in ECMAScript 2024: “In-place resizable ArrayBuffers”, proposed by Shu-yu Guo “ArrayBuffer.prototype.transfer and friends” proposed by Shu-yu Guo, Jordan Harband and Yagiz Nizipli
In this blog post, we take a look at the ECMAScript 2025 feature “Duplicate named capturing groups” which was proposed by Kevin Gibbons. It’s a feature for regular expressions that enables us to use the same capture group name more than once. The only restriction is that duplicates must exist in different alternatives – in other words: At any time, there can’t be more than one capture with a given name. Why is that useful? It lets us reuse regular expression fragments and match-processing code between alternatives.
In this blog post, we look at the ECMAScript proposal “Iterator helpers” by Gus Caplan, Michael Ficarra, Adam Vandolder, Jason Orendorff, Kevin Gibbons, and Yulia Startsev. It introduces utility methods for working with iterable data: .map(), .filter(), .take(), etc. The style of the proposed API clashes with the style of the current iteration API. We’ll explore how we can fix that.
This blog post describes the ECMAScript proposal “ShadowRealm API” by Dave Herman, Caridy Patiño, Mark S. Miller, Leo Balter, and Rick Waldron. Class ShadowRealm provides a new way of evaluating code at runtime – think eval() but better: Each instance has its own global JavaScript scope. Code is evaluated in that scope. If it changes global data, that only affects the ShadowRealm, but not the real global data.
The proposal “Pipe operator (|>) for JavaScript” (by J. S. Choi, James DiGioia, Ron Buckton and Tab Atkins) introduces a new operator. This operator is an idea borrowed from functional programming that makes applying functions more convenient in many cases. This blog post describes how the pipe operator works and what its use cases are (there are more than you might expect!).
The ecosystem around delivering ECMAScript modules via packages is slowly maturing. This blog post explains how the various pieces fit together: Packages – JavaScript’s units for software distribution The three kinds of ECMAScript module specifiers Providing and using packages via module specifiers in Node.js, Deno and web browsers