TypeScript adds a new flag to its compiler with version 5.8: erasableSyntaxOnly. It ensures you won’t use TypeScript features that generate code.| oida.dev
tokio::join! lets you run multiple futures concurrently, and returns the output of all of them. For JavaScript developers: Promise.all is a good equivalent.| oida.dev | TypeScript, Rust
This is a long section. Here are some anchors to jump to the respective part:| oida.dev | TypeScript, Rust
Let’s get started with our first Tokio app. Create a new project using Cargo and add the tokio dependency either to your Cargo.toml file or directly on the command line.| oida.dev | TypeScript, Rust
This guide is a collection of articles and exercises covering how to write network applications with Tokio. Its base is a workshop I gave over the last few years called “Network Applications using Tokio.” The slides are available in the respective section.| oida.dev | TypeScript, Rust
Welcome to my new website! I have wanted to create a new and updated version of this page for a long time. In fact, I feel that the old one kept me from blogging; I couldn’t stand watching my own webpage anymore.| oida.dev | TypeScript, Rust
One thing that I see more often recently is that folks find out about the never type, and start using it more often, especially trying to model error handling. But more often than not, they don’t use it properly or overlook some fundamental features of never. This can lead to faulty code that might act up in production, so I want to clear doubts and misconceptions, and show you what you can really do with never.| oida.dev | TypeScript, Rust
I’m writing books about TypeScript and I do workshops and trainings online and in-house. Every time I meet a new group of developers there are some TypeScript facts that they need to be confronted with:| oida.dev | TypeScript, Rust
In the same codebase as last time, we extract data from a HashMap<String, String> called headers, presumably dealing with something similar to HTTP headers.| oida.dev | TypeScript, Rust
The following piece of code takes a PathBuf and extracts the file name, eventually converting it to an ownedString.| oida.dev | TypeScript, Rust
Oops, I did it again! I’m writing another book, and it’s again about TypeScript. I’m happy to announce The TypeScript Cookbook, to be published in 2023 by O’Reilly. You can check it out in Early Release on the O’Reilly website.| oida.dev | TypeScript, Rust
There is rarely a head-scratcher in TypeScript as prominent as trying to access an object property via iterating through its keys. This is a pattern that’s so common in JavaScript, yet TypeScript seems to through all the obstacles at you. This simple line:| oida.dev | TypeScript, Rust
Universal JavaScript. JavaScript that works in every environment. JavaScript that runs on both the client and the server, something thinking about for years (see 1, 2). Where are we now?| oida.dev | TypeScript, Rust
I missed a little anniversary. Roughly 10 years ago (on April 8, 2012), I started blogging on oida.dev! Time flies! I think this is my longest-running project, let’s take some time to reflect.| oida.dev | TypeScript, Rust
Rust’s trait system has a feature that is often talked about, but which I don’t see used that often in application code: Implementing your traits for types that are not yours. You can see this a lot in the standard library, and also in some libraries (hello itertools), but I see developers shy away from doing that when writing applications. It’s so much fun and so useful, though!| oida.dev | TypeScript, Rust
Usually, when doing TypeScript talks, I just open up a code editor and hack away some cool types that help in a certain scenario. This time, I was asked to do the same thing but within a 20-minute time limit. This has been super tough, so I scripted the entire thing and resorted to slides that have certain progress. Fewer chances for me to screw up! This allows me to give you not only the slides but also a write-up of this talk. I’ll give myself a bit of freedom and flesh it out where appro...| oida.dev | TypeScript, Rust
“TypeScript and I are never going to be friends”. Oh wow, how often have I heard this phrase? Learning TypeScript, even in 2022, can be frustrating it seems. And for so many different reasons. People who write Java or C# and find out things are working differently than they should. Folks who have done JavaScript most of their time and are being screamed at by a compiler. Here are some mistakes I’ve seen people do when getting started with TypeScript. I hope they’re helpful to you!| oida.dev | TypeScript, Rust
Learning and teaching Rust has been a big part of me in the last couple of years. Interest in the Rust programming language has brought me to found the Rust Linz meetup with Rainer Stropek, to teach Rust at the local university, and to do a tonof workshops on the topic. It’s a lot of fun! It has introduced me to one of the most welcoming communities. And I love seeing Rust code getting in production and keeping all the promises it gives us. Folks who I’m in contact with through various ch...| oida.dev | TypeScript, Rust
There’s a new section on this website! Since today, you’re able to see full coverage of my workshops and talks in the new slides and coverage section. That’s the announcement. If you want to see more, head over to the new section. If you want a little “Making of”, please continue with this article.| oida.dev | TypeScript, Rust
With the most recent type system features like conditional types or variadic tuple types, one technique to describe a function’s interface has faded into the background: Function overloads. And there’s a good reason for that. Both features have been implemented to deal with the shortcomings of regular function overloads.| oida.dev | TypeScript, Rust
Update April 2022: With the update to React 18, a lot of those problems have been fixed. See this pull request for more details| oida.dev | TypeScript, Rust
A couple of days ago I found this beauty on the internet: Give up and use any. That’s a fantastic website, absolutely hilarious! It also shows how much TypeScript has grown in popularity. You have to have a certain reach to get critics to create websites like this.| oida.dev | TypeScript, Rust
This is a follow-up to Error handling in Rust from a couple of days ago. The moment we want to use error propagation for different error types, we have to rely on trait objects with Box<dyn Error>, which means we defer a lot of information from compile-time to runtime, for the sake of convenient error handling.| oida.dev | TypeScript, Rust
I had the chance to toy around with Deno recently. And with “toy around” I mean dissecting it into little pieces and see how the sausage was made. So, my view is not from a user’s perspective who wants to create and run apps with it, but rather one who has a huge interest in JavaScript runtimes, Serverless, and Rust.| oida.dev | TypeScript, Rust
I started doing university lectures on Rust, as well as holding workshops and trainings. One of the parts that evolved from a couple of slides into a full-blown session was everything around error handling in Rust, since it’s so incredibly good!| oida.dev | TypeScript, Rust
Sometimes when writing TypeScript, some of the things you’d usually do in JavaScript work a little different and cause some weird, and puzzling situations. Sometimes you just want to assign a value to an object property and get a weird error like “Type ‘string | number’ is not assignable to type ‘never’. Type ‘string’ is not assignable to type ‘never’.(2322)”| oida.dev | TypeScript, Rust
It’s Tuesday! The day of your weekly dependabot alerts from GitHub! A nice reminder to check on your projects, and usually just a few clicks worth of work, the automatic update is wonderful.| oida.dev | TypeScript, Rust
The Array.prototype.includes function allows searching for a value within an array. If this value is present, the function returns true! How handy! Of course, TypeScript has proper typings for this JavaScript functionality.| oida.dev | TypeScript, Rust
If you are creating component libraries and design systems in React, you might already have fowarded Refs to the DOM elements inside your components.| oida.dev | TypeScript, Rust
I do a lot of architecture work lately, and one thing that seems to appear more often than I thought it would be are module names that have generic-sounding names like shared, util, or core. There is something confusing about them, as they don’t tell you what’s inside!| oida.dev | TypeScript, Rust
My blog is a chronicle of learning new things. Most of the articles I write are notes on how I solved problems that I found in my everyday work. And every now and then I have to urge to learn something new!| oida.dev | TypeScript, Rust
When you are coming from languages like Java, C++, or C#, you are used to doing your error handling by throwing exceptions. And subsequently, catching them in a cascade of catch clauses. There are arguably better ways to do error handling, but this one has been around for ages and given history and influences, has also found its way into JavaScript.| oida.dev | TypeScript, Rust
I write a lot about TypeScript and I enjoy the benefits it gives me in my daily work a lot. But I have a confession to make, I don’t really like writing types or type annotations. I’m really happy that TypeScript can infer so much out of my usage when writing regular JavaScript so I’m not bothered writing anything extra.| oida.dev | TypeScript, Rust
My book TypeScript in 50 Lessons features interludes. Short texts on TypeScript culture that provide room to breathe between heavy, technical tutorials. One of those interludes gives some opinionated advice on how to name generic variables.| oida.dev | TypeScript, Rust
This is the third article in a series of articles where I want to highlight ways on how to keep your TypeScript code neat and tidy. This series is heavily opinionated and you might find out things you don’t like. Don’t take it personally, it’s just an opinion.| oida.dev | TypeScript, Rust
This is the second article in a series of articles where I want to highlight ways on how to keep your TypeScript code neat and tidy. By nature, this series is heavily opinionated and is to be taken with grains of salt (that’s plural).| oida.dev | TypeScript, Rust
This is the first article in a series of articles where I want to highlight ways on how to keep your TypeScript code neat and tidy. This series is heavily opinionated, so don’t be angry if I ditch a feature that you learned to like. It’s not personal.| oida.dev | TypeScript, Rust
I’ve written a new book! On October 6, the pre-release of TypeScript in 50 Lessons started. It’s 450 pages, published by the wonderful people at Smashing Magazine, and available to read right now! The printed version is being produced as I write, and will be shipping in mid-November.| oida.dev | TypeScript, Rust
You might have heard of Preact, the tiny 3KB alternative to React. It has been around for a while, and since its inception, it claims to be API and feature compatible compared to the more widely used Facebook library.| oida.dev | TypeScript, Rust
Sometimes when writing JavaScript, I want to shout “This is ridiculous!”. But then I never know what this refers to.| oida.dev | TypeScript, Rust
Working with real, native, ECMAScript modules is becoming a thing. Tools like Vite, ES Dev server, and Snowpack get their fast development experience from leaving module resolution to the browser. Package CDNs like Skypack and UnPKG are providing pre-compiled ES modules which you can use in both Deno and the browser just by referencing a URL.| oida.dev | TypeScript, Rust
Update: React types for version 18 changed a lot! If you encounter problems described in this article, make sure you update to the latest version!| oida.dev | TypeScript, Rust
This list is a collection of component patterns for React when working with TypeScript. See them as an extension to the TypeScript + React Guide that deals with overall concepts and types. This list has been heavily inspired by chantastic’s original React patterns list.| oida.dev | TypeScript, Rust
Recently I wanted to use a ResizeObserver in my application. ResizeObserver recently landed in all major browsers, but when you use it in TypeScript — at the time of this writing — ResizeObserver won’t be recognized as a valid object (or constructor). So why is that?| oida.dev | TypeScript, Rust
Update: Please note that this article already has some age and Vite has seen significant updates. Also, the Preact team has created their own preset for Vite which you can find here. Be sure to check that out!| oida.dev | TypeScript, Rust
Recently, I had to convert a union type into an intersection type. Working on a helper type UnionToIntersection<T> has taught me a ton of things on conditional types and strict function types, which I want to share with you.| oida.dev | TypeScript, Rust
For the redesign of this blog, I created Twitter title cards that are generated automatically. So whenever people share my stuff on social media, they get a nice card telling them the article’s title and post date.| oida.dev | TypeScript, Rust
The other day, I had some friends frowning over the 800KB size of a node application. This brought to my attention that I never really worried about the size of my dependencies in a Node.js application.| oida.dev | TypeScript, Rust
TypeScript 4.0 is supposed to be released in August 2020, and one of the biggest changes in this release will be variadic tuple types. And even though his feature is hot of the press at the time of this writing, it’s worth checking out and see what we can do with it. Note that stuff here might be subject to change, so be cautious! I will try to keep this page up to date until 4.0 is in RC or released.| oida.dev | TypeScript, Rust
Note: Be very careful with this technique. Better checkout my new approach.| oida.dev | TypeScript, Rust
I originally wanted to launch my new website on June 1st, but there were more important things happening at the moment than relaunching a tech blog. Truth be told, it was really hard for me focussing on anything else but the protest. The ongoing protests have not lost any importance. Do your part and educate yourself and be an ally.| oida.dev | TypeScript, Rust
I recently stumbled upon a question on Reddit’s LearnTypeScript subreddit regarding custom React hooks. A user wanted to create a toggle custom hook, and stick to the naming convention as regular React hooks do: Returning an array that you destructure when calling the hook. For example useState:| oida.dev | TypeScript, Rust
In JavaScript, you can define object properties on the fly with Object.defineProperty. This is useful if you want your properties to be read-only or similar. Think of a storage object that has a maximum value that shouldn’t be overwritten:| oida.dev | TypeScript, Rust
TypeScript’s control flow analysis lets you narrow down from a broader type to a more narrow type:| oida.dev | TypeScript, Rust
boolean is a fun primitive data type in JavaScript. In TypeScript, it allows for a total of four values| oida.dev | TypeScript, Rust
If you come from traditional, strongly typed languages you might be familiar with the concept| oida.dev | TypeScript, Rust
symbol is a primitive data type in JavaScript and TypeScript, which, amongst other things,| oida.dev | TypeScript, Rust
You might well see that my blog starts to center around TypeScript a lot recently. This might look| oida.dev | TypeScript, Rust
React typings for TypeScript come with lots of interfaces for all possible HTML elements| oida.dev | TypeScript, Rust
Mapped types are great, as they allow for the flexibility in object structures JavaScript is known for.| oida.dev | TypeScript, Rust
TypeScript is a structural type system. This means as long as your data structure satisfies a contract,| oida.dev | TypeScript, Rust
If you are doing traditional OOP with TypeScript, the structural features of TypeScript might| oida.dev | TypeScript, Rust
Now that we have everything wired up, it’s time to record, direct and stream!| oida.dev | TypeScript, Rust
We successfully set up the projector in the first chapter.| oida.dev | TypeScript, Rust
We successfully set up the projector in our last chapter.| oida.dev | TypeScript, Rust
When we did Script’18 in January 2018, we borrowed an A/V equipment worth of 35.000 EUR| oida.dev | TypeScript, Rust
CSS in JS! In all possible ways. Or at least, in 5 of them. I collected a list of popular ways| oida.dev | TypeScript, Rust
This took me exactly one year. But mostly due to not finding a lot to talk about. Typings| oida.dev | TypeScript, Rust
Welcome to this little primer on TypeScript and React! A match made in heaven!| oida.dev | TypeScript, Rust
React has a built-in way of type checking called prop types. This works at run time and is a great| oida.dev | TypeScript, Rust
One way to think about TypeScript is as a thin layer around JavaScript that adds type annotations.| oida.dev | TypeScript, Rust
Factory functions are a popular tool in JavaScript to create a diversity of objects with a single call.| oida.dev | TypeScript, Rust
JAMStack seems to be one of the most trending topics right now. So are serverless web apps. Hot and loved! I’ve seen some tweets, articles and even live presentations just this week that talk about JAMStack and serverless web apps as if they are the same. For good reason. In an ideal scenario, serverless web apps and JAMStack sites/apps are indistinguishable.| oida.dev | TypeScript, Rust
This post originally appeared on dev.to| oida.dev | TypeScript, Rust
When you work on modern JS apps you most likely use Webpack. Webpack always looked like a very complicated build tool to me, until I realised that it’s nothing but a JavaScript bundler. A JavaScript bundler that allows you to bundle everything! CSS, Markdown, SVGs, JPEGs, you name. It exists and helps the web, you can bundle it.| oida.dev | TypeScript, Rust
It’s that time of the year again! For the fourth time in a row, I’m sharing my most| oida.dev | TypeScript, Rust
React’s context API has be slumbering inside for a while. With one of the latest releases, they decide to open| oida.dev | TypeScript, Rust
JSX elements can be nested, like HTML elements. In React, children elements are accessible via| oida.dev | TypeScript, Rust
TypeScript comes with a ton of built in generic types that ease your development workflow. Here’s a list of all built-in generic types, with examples!| oida.dev | TypeScript, Rust
Type predicates in TypeScript help you narrowing down your types based on conditionals. They’re similar to type guards, but work on functions.| oida.dev | TypeScript, Rust
If you follow me you know that I’m super late to the React game. It was not until functional components showed up that I got| oida.dev | TypeScript, Rust
Hooks are a new feature in React that I personally find pretty exciting. Shortly after their release in React 16.7., people started| oida.dev | TypeScript, Rust
We just started the Call for Presentations for the upcoming DevOne conference,| oida.dev | TypeScript, Rust
I’m writing these lines as I fly back from an excellent Angular Connect. I started public speaking a couple of years ago, and this particular talk will be one I’m going to remember for a long time. I think it’s easily on par with my most favourite speaking experience that I had back in 2013 with Breaking Development.| oida.dev | TypeScript, Rust
When starting with TypeScript it took not much time to stumble upon some of the type system’s odds. Odds that make a lot of sense if you take a closer look. In this article I want to show you why and how in some cases, TypeScript allows non-matching method signatures.| oida.dev | TypeScript, Rust
When developing, there’s three things that I absolutely enjoy:| oida.dev | TypeScript, Rust
This post was originally published on Medium in 2015. I decided to carry it over to my blog to keep it safe| oida.dev | TypeScript, Rust
This post was originally published on Medium in 2015. I decided to carry it over to my blog to keep it safe| oida.dev | TypeScript, Rust
For some of my performance audits I need an exact copy of the webpage as it is served by my clients infrastructure. In some cases, it can be hard to get to the actual artefact. So it’s easier to fetch it from the web.| oida.dev | TypeScript, Rust
The other day I was holding a workshop on performance optimisation for single page applications. For this workshop I needed an example that I could optimise step by step. I decided not to use a framework, as I didn’t know the experiences and background of my attendees. Also, I didn’t want to draw attention to framework details, rather focus on concepts that build on the platform and that are universally applicable to SPAs.| oida.dev | TypeScript, Rust
Before we start, have a look at this image. It is from a German book from the early Nineties, and it features some very interesting cover artwork. A knight with a cape and a big bushy mustache rides a friendly green dragon. A castle, a dolphin, and some animals are in the background. Focus on the details; we will return to that image at the end.| oida.dev