Hi, I’m Andrzej👋

Welcome to my personal scratchpad

You Are Using Path Aliases Backwards  [draft]

July 2, 2024

TypeScript Error 1272  [draft]

A type referenced in a decorated signature must be imported with ‘import type’ or a namespace import when ‘isolatedModules’ and ‘emitDecoratorMetadata’ are enabled. What does it mean, when can it happen and what should you do about it? When The following conditions must be met in order to trigger this error: your TS project uses emitDecoratorMetadata your TS project uses isolatedModules your TS project is set up to modern moduleResolution: Bundler, Node16 or NodeNext the imported is referenced in a decorated signature the imported type is really just a type or an interface and lastly:...

January 24, 2024

I finally understood Nx usefulness

I was planning on releasing a longer post about Nx, but I got lost in my line of reasoning. So here goes a shorter note, just to share some thoughts. TypeScript project references Before I get to the Nx part, I wanted to talk about a useful TypeScript’s feature: project references. It allows you to divide your project into separate sub-projects that are understood by TypeScript, as long as you reference the root directories of used projects (or their tsconfig....

December 24, 2023

Envs and Twelve Factor App

Intro In the Twelve Factor App manifesto there is a section III. dedicated to config management. In short, it advises that the configuration of the app should come “from outside”, not from inside. Then there is this paragraph about “grouping”: Another aspect of config management is grouping. Sometimes apps batch config into named groups (often called “environments”) named after specific deploys, such as the development, test, and production environments in Rails....

December 15, 2023

Nx  [draft]

Recently, I spent some time evaluating a quite popular monorepo tool – Nx. I was trying to understand what it can offer vs how much you need to invest in this tool’s maintenance. Here’s what I found (these are my personal opinions and your mileage might vary). What does Nx offer
 
according to their documentation: running tasks (including distributed execution) caching task results (including remote caching) visualising the project graph automation of updating dependencies enforcing module boundaries editor integration What does Nx actually offer
 
when you have an existing monorepo with a Docker + CI/CD setup and you’re mostly interested in the local experience:...

December 10, 2023

Class fields, again

Two weeks ago I wrote about class fields, TC39 and TypeScript. This time I want to go into the details of transpilation output related to class fields. Intro You see, I have this class in my TypeScript codebase: class Foobar { public foo = 31; constructor(public x: string){ } public bar = this.x.toUpperCase(); } Obviously, this is some real production-grade code. Now, to set the scene: my tsconfig.json has the target set to ES2021 and I am not using the useDefineForClassFields flag yet....

October 31, 2023

Yarn being Yarn

When fighting with some tools working not as expected, it is always good to read an insightful commit message. Especially if it’s your own commit message, from 8 months ago.

October 25, 2023

Class fields, TC39 and TypeScript

It’s June 2022 and a new version of ECMAScript has just been released. One of the novelties that this version has brought us are the class fields. You see, Object-Oriented languages usually have this feature, where you can declare a field on a class in the top-most scope of the class like this: class Foobar { private someNumberField = 10; public aFieldWithNoValue; } Well, aside from the obvious lack of access keywords, this was still impossible in JavaScript....

October 20, 2023

Interesting Stuff 2  [draft]

SNAKISMS – Snake game(s) with philosophical twists ByteByteGo Newsletter – I stumbled upon this on Twitter; the tweet was about differences in ApplePay and GooglePay implementations. The newsletter/blog itself is very brief, it merely scratches some interesting topics on the surface, so it’s more like a research starter. Nonetheless, these were the most interesting to me: Apple/Google Pay, Card Network diagram

August 12, 2022

Https Stuff

A couple of things I learned yesterday when browsing Hacker News. Upgrade-Insecure-Requests Content-Security-Policy: upgrade-insecure-requests; This means that if for any reason a non-navigational content on your website contains http instead of https (by mistake), then the browser will try to access it via https This won’t change navigation <a> links to 3rd party websites. HTTP Strict-Transport-Security (HSTS) Strict-Transport-Security: max-age=<expire-time> This header instructs the browser that this website needs to be accessed only via https for as long as the header is not expired....

August 4, 2022