I was recently able to confirm that a certain new charger that I tried out is able to charge my iPad Pro (2017) about twice as fast as the original charger. (My results can be found at the very end of the article.)

NOT by using apps such as Ampere, which despite the many positive reviews provide wildly inconsistent results. Multiple runs with the same charger and cable resulted in numbers that were up to ~200% off from each other!

Instead, I realized that Apple’s own app Shortcuts can be used for pretty decent benchmarking.

Measuring charging speed

It’s done by triggering notifications…

Most laptops that provide decent performance (and can use 64 GB RAM) are just too damn noisy. I have recently found one that isn’t.

It should be noted that it does require you to “mess around a bit” with either tools I wrote (for both Windows and Linux! 🎉) or use modified DLLs to get around manufacturer restrictions. If it wasn’t for that, I would’ve returned even my top pick in this list.

I’ll describe all machines I’ve tried out in the past weeks and what I learned from all this in case you happen to be considering one of…

PLEASE NOTE: This is a follow-up to my article Static type checking for collections of string constants in TypeScript.

I recently learned about const assertions (new in TS 3.4) through this article about Redux (via TypeScript Weekly). It made me realize that I could probably simplify my previous solution drastically. Turns out — yes, it’s possible.

While I can’t share an update for the React-based example because codesandbox currently doesn’t support custom TS versions (which may change very soon), here is the adjusted more general TS gist (or interactive in the TypeScript Playground):

Such a small change but quite the impact if your collections are as big as ours. 💥😉

… when TS’ string enums don’t quite get you there.

The ultimate goal

UPDATE: I was recently able to simplify the solution I describe in this article using const assertions. See my brief follow-up article here.

A lot of string constants are used in the UI component library I currently work on at RadarServices. While migrating it from Flow to TypeScript, I wondered whether the workflow couldn’t be improved upon. Which consisted of many runtime checks to ensure that only constants of a certain allowed set (and in many cases subsets) were in fact passed. As well as tests that ensure that those checks work.

I had never used TS’ string enums before…

Andreas Opferkuch

Front End Engineer. See https://github.com/s-h-a-d-o-w

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