2022-09-20
🔗Got a spam text today addressed to a group of people, and the larger disruption than the initial text itself was everyone else angry and replying to the "sender." When of course the sender of the text was the only party not seeing it, since it was just a computer program. Oh well :)
Learning
Typescript Const Assertions
I keep forgetting this, so writing it down here. Typescript's const assertion declarations are helpful for telling Typescript that you aren't going to mutate an object and so it can more narrowly type the object.
// Typed as ['a', 'b'] instead of string[];
const = as const;
// Typed as [number, number] instead of number[];
const = as const;
This especially comes in handy when the values need to match up to keys in an object or you have a function argument of type [number, number]
to ensure a certain array length.
Links
- A good take on technical moats from Dan Robinson, CTO of Heap. Essentially, technical moats are not single "killer features," but the result of lots of iteration and development of deep understanding.
- Singlestore's overview of skiplists provides one of the better descriptions I've seen of how the data structure actually works to provide fast lookups and updates.