News
Entertainment
Science & Technology
Life
Culture & Art
Hobbies
News
Entertainment
Science & Technology
Culture & Art
Hobbies
In this chapter we explore two topics: A shell is like browser console, but for the operating system instead of for JavaScript. It helps us with programming by running the tools (programs) we need to get things done. Node.js is a program that lets us run JavaScript code outside browsers – which we can use for a variety of things.
JavaScript has two common patterns: Maps: We check the existence of a key via .has() before retrieving the associated value via .get(). Arrays: We check the length of an Array before performing an indexed access. These patterns don’t work as well in TypeScript. This blog post explains why and presents alternatives.
In this blog post we look at: The current best practice for deploying library packages: .js, .js.map, .d.ts, .d.ts.map, .ts Recent new developments in compiling and deploying TypeScript: type stripping, isolated declarations, JSR, etc. What the future of deploying TypeScript might look like: type stripping in browsers, etc.
Today’s announcement by Microsoft: [...] we’ve begun work on a native port of the TypeScript compiler and tools. The native implementation will drastically improve editor startup, reduce most build times by 10×, and substantially reduce memory usage. This blog post looks at some of the details behind the news.
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.