Originally posted on Dev.to

TypeScript 4.2 was recently released, with many cool new features and improvements. It’s really impressive to see how TypeScript improves the developer experience one step at a time.
In this short post we will focus one feature, called Smarter Type Alias Preservation. I can say for myself that I really anticipate this feature. In a nutshell, it improves error messages related to union-types of union-types. I hope that in a few minutes you’ll understand better what it means, and why it is useful.

Don’t get lost when unioning types. (Photo by Emily Blincoe)

So What’s the Problem?

Until TypeScript 4.2, when using a union type which contained at least one…

This post was originally published in dev.to

The Pain of Measuring a Project Migration

In the past few years I’ve had the chance to participate in ongoing project migrations like AngularJS to React, or JavaScript to TypeScript. Such migrations are usually incremental and take time.
In most cases, it’s hard to analyze what’s the status of the migration:

  • Are we keeping a certain velocity, or are we slowing down?
  • Do we obey defined rules, like stop adding AngularJS files when migrating to React?
  • Which developer contributed the most to the migration?

Enter Git Metric

In an attempt to help with such questions, I’ve recently published a small utility called Git…

At Testim.io we care about code quality and UX. For this reason, we use various tools that make development easier and more accurate. Among others, we use Stylelint to lint our SCSS and CSS files. One of the powerful features of stylelint is the ability to add rules of your own, which will fit your project’s needs. While stylelint provides an API for adding custom rules, it can be a bit confusing when doing so for the first time.

In this blog post, we will go through the steps for adding a new custom stylelint rule to your project:

  1. Declaring…

I’ve started working at Testim recently. We have an amazing tool which gives you the power to create stable end-to-end tests quickly.

Testim has just launched an awesome new (free) tool that will help you write functional tests faster. The Playground enables you to record tests and then copy the code that can run on your Playwright testing framework.

Check it out on Product Hunt!

Photo by Jesse Ramirez on Unsplash

The following scenario should be familiar to most developers: You look for a utility function in an existing project. Quickly you find it and realize it is private, so you can’t use it in your class. Assuming you won’t copy-paste the function, a refactor is required. Extracting the function to a new designated class seems like the best solution.

One question remains — how will you extract the function?

The first option is a static function in a new class. The second option, assuming you use any dependency injection framework (e.g. Guice), is an injectable instance of a new, non-static…

This September (2019), I attended CSSConf and JSConf in Budapest. Both conferences were single-tracked, with a total of 39 amazing talks. It was an incredible experience, and I learned many new things. Below, I’ve listed my top 9 favourite talks, in chronological order as they were presented in the conferences, together with explanations and recommendations.

Videos of the conferences in their entirety can be found here: CSSConf, JSConf day 1, JSConf day 2.

So here goes!

1. CSS Games and Drawings in the Real World: Useful or Just Fun?

By Giulia Cardieri | 📝 Slides | 📼 Video

Giulia spoke about creating drawings and games using only CSS and HTML. She mentioned how…

Ever wondered how is this preview generated?

Photo by Paul Skorupskas on Unsplash

High chances are you got to this post through some link sharing.

High chances are the link had some preview: the post header, a short summary, and an image as well.

Even higher chances that it’s not the first time you have seen such preview.

Ever wondered what generates these previews, or how can you start using them? I hope I’ll answer some of your questions in the post.

Link Previews? What’s That?

For those of you who are still wondering what previews I’m referring to, here are some examples:

Image by Geralt on Needpix

Recently, I’ve learned about a useful TypeScript operator: The non-null assertion operator. It negates null and undefined types from variables.

In this post, I will explain how and when to use this operator and give some examples of where it can help you.

TL;DR: Adding an exclamation mark after a variable will ignore undefined or null types.

How to Use the Non-Null Assertion Operator

The non-null assertion operator takes a typed variable and removes the undefined and null types from it.

Using the operator is as simple as adding an exclamation mark.

  1. Ignore a variable’s undefined | null types:

2. Ignore an undefined type when…

Recently, I discontinued my work on a side project I’ve started 18 months ago.
Doesn’t sound like a big success story, right? I thought so too.

But looking back, I realize that I learned a lot of things, techniques and tools that will help me next time I’ll start a side project. In this post, I've gathered some of the methods and conclusions from the past year and a half.

If you want to start working on a side project, or willing to become more efficient — this post can help you.

If you’re the TL;DR type, you can find…

Importing a legitimate library has recently broken our production bundle, by introducing a “Syntax Error” exception. This short article describes the error and the investigation process that led us to the solution. I hope that at some point, someone will be able to save precious time by referring this post.

TL;DR When bundling in production mode with Webpack v4, TerserPlugin minifies the bundle, which can sometimes corrupt an already-minified 3rd party bundle. Adding the option keep_fnames: /./ will solve this problem without increasing the bundle size.

Aggressive minification (Photo by stevepb)

Mysterious Syntax Error

In one of our current projects, we noticed an odd behavior — some of…

Omri Lavi

Frontend lover ❤️ Tooling enthusiastic 🛠️ React / TypeScript clean-coder ⚛️ 🧼

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store