var please = require('share');
console.log('thank you');

NEW !!!

Friday, 31 July, 2020 UTC

TypeScript + React: Why I don't use React.FC

In my recent article on TypeScript and React component patterns I’ve stated that I don’t use the built-in type React.FC<> but rather be explicit with typing children. I didn’t state why, and it sparked some interest. That’s why I want to elaborate ... more

Tuesday, 28 July, 2020 UTC

TypeScript + React: Component patterns

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 ... more

Friday, 17 July, 2020 UTC

TypeScript: Augmenting global and lib.dom.d.ts

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). ... more

Monday, 6 July, 2020 UTC

Vite with Preact and TypeScript

Vite is a new web development build tool by Evan You, the creator of Vue.js. It’s in early beta at the time of this writing and was mainly created for Vue 3, but it’s also able to build React and Preact and has TypeScript support out of the box. ... more

Monday, 29 June, 2020 UTC

TypeScript: Union to intersection type

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. ... more

Thursday, 25 June, 2020 UTC

11ty: Generate Twitter cards automatically

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. ... more

Monday, 22 June, 2020 UTC

Are large node module dependencies an issue?

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. ... more

Friday, 19 June, 2020 UTC

TypeScript: Variadic Tuple Types Preview

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 ... more

Wednesday, 17 June, 2020 UTC

TypeScript: Improving Object.keys

TypeScript’s predefined types in lib.d.ts are usually very well-typed and give tons of information on how to use built-in functionality as well as providing you with extra-type safety. Until they don’t. Consider the following example with an object type ... more

Tuesday, 16 June, 2020 UTC

Remake, Remodel. Part 4.

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 ... more

Wednesday, 10 June, 2020 UTC

Black Lives Matter

Me, the author of fettblog.eu, and all contributors and peers stand in solidarity with the Black community, today and every day. ... more

Wednesday, 25 March, 2020 UTC

TypeScript + React: Typing custom hooks with tuple types

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 ... more

Thursday, 6 February, 2020 UTC

TypeScript: Assertion signatures and Object.defineProperty

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: ... more

Monday, 3 February, 2020 UTC

TypeScript: Check for object properties and narrow down type

TypeScript’s control flow analysis lets you narrow down from a broader type to a more narrow type: ... more

Wednesday, 11 September, 2019 UTC

Boolean in JavaScript and TypeScript

boolean is a fun primitive data type in JavaScript. In TypeScript, it allows for a total of four values Wait, four? ... more

Friday, 6 September, 2019 UTC

void in JavaScript and TypeScript

If you come from traditional, strongly typed languages you might be familiar with the concept of void : A type telling you that functions and methods return nothing when called. ... more

Wednesday, 4 September, 2019 UTC

Symbols in JavaScript and TypeScript

symbol is a primitive data type in JavaScript and TypeScript, which, amongst other things, can be used for object properties. Compared to number and string , symbol s have some unique features that make them stand out. ... more

Wednesday, 28 August, 2019 UTC

Why I use TypeScript

You might well see that my blog starts to center around TypeScript a lot recently. This might look like a strong deviation from what I usually blog and advocate: Performant, accessible and resilient web sites. ... more

Tuesday, 27 August, 2019 UTC

TypeScript + React: Extending JSX Elements

React typings for TypeScript come with lots of interfaces for all possible HTML elements out there. But sometimes, your browsers, your frameworks or your code are a little bit ahead of what’s possible. ... more

Monday, 26 August, 2019 UTC

TypeScript: Validate mapped types and const context

Mapped types are great, as they allow for the flexibility in object structures JavaScript is known for. But they have some crucial implications on the type system. Take this example: ... more

Monday, 19 August, 2019 UTC

TypeScript: Match the exact object shape

TypeScript is a structural type system. This means as long as your data structure satisfies a contract, TypeScript will allow it. Even if you have too many keys declared. ... more

Thursday, 15 August, 2019 UTC

TypeScript: The constructor interface pattern

If you are doing traditional OOP with TypeScript, the structural features of TypeScript might sometimes get in your way. Look at the following class hierachy for instance: ... more

Tuesday, 6 August, 2019 UTC

Streaming your Meetup - Part 4: Directing and Streaming with OBS

Now that we have everything wired up, it’s time to record, direct and stream! If you missed the previous parts, check out the table of contents to quickyl jump to a previous section. ... more

Tuesday, 30 July, 2019 UTC

Streaming your Meetup - Part 3: Speaker audio

We successfully set up the projector in the first chapter. We are able to record the speaker’s video as described in the second chapter. Now let there be sound! ... more

Thursday, 25 July, 2019 UTC

Streaming your Meetup - Part 2: Speaker video

We successfully set up the projector in our last chapter. Now it’s time to record the speaker himself. I’ll show you a couple of options how you can record the speaker video. It’s up to your budget and up to the quality you want to achieve. ... more

Wednesday, 24 July, 2019 UTC

Streaming your Meetup - Part 1: Basics and Projector

When we did Script’18 in January 2018, we borrowed an A/V equipment worth of 35.000 EUR to make sure we get kick-ass videos. A+ camera, an A/V mixer and a hard disc recording system that does editing on the fly. We wanted to go live with our recordings ... more

Friday, 19 July, 2019 UTC

TypeScript and React Guide: Added a new styles chapter

CSS in JS! In all possible ways. Or at least, in 5 of them. I collected a list of popular ways on how to style React components: emotion, styled components, styled-jsx, inline styles and webpack imports. The focus is again on typings. How well do they ... more

Thursday, 18 July, 2019 UTC

TypeScript and React Guide: Added a new render props chapter

This took me exactly one year. But mostly due to not finding a lot to talk about. Typings for React render props are extremely easy and show through typings what its all about: About sharing state between components. Check out the chapter in my TypeScript ... more

Wednesday, 17 July, 2019 UTC

TypeScript and React Guide: Added a new prop types chapter

React has a built-in way of type checking called prop types. This works at run time and is a great accompanying feature for TypeScript. I’ve added a small chapter on prop types in my React and TypeScript guide. ... more

Tuesday, 16 July, 2019 UTC

TypeScript without TypeScript -- JSDoc superpowers

One way to think about TypeScript is as a thin layer around JavaScript that adds type annotations. Type annotations that make sure you don’t make any mistakes. The TypeScript team worked hard on making sure that type checking also works with regular ... more