From 642f0c8b1240dbbec7c8a5ea70acf72688d41629 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 3 Jan 2024 12:31:43 +0000 Subject: [PATCH] Update TIL listing --- README.md | 3 ++- feed.json | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b89d19..e323bc2 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,9 @@ This is a collection of short notes of the things I have learned on a daily basis while working on different technologies. I share these notes as I [learn in public](https://www.learninpublic.org/). -_**111** TILs and counting..._ +_**112** TILs and counting..._ +- 2024-01-03: [TypeScript: ElementRef for React.useRef](https://github.com/petermekhaeil/til/blob/master/./learnings/ts-react-elementref.md) - 2024-01-02: [Null is a billion-dollar mistake](https://github.com/petermekhaeil/til/blob/master/./learnings/null-billion-dollar-mistake.md) - 2024-01-01: [TypeScript: exactOptionalPropertyTypes](https://github.com/petermekhaeil/til/blob/master/./learnings/ts-exact-optional-property-types.md) - 2023-12-27: [Use Zod to validate File input](https://github.com/petermekhaeil/til/blob/master/./learnings/zod-validate-file.md) diff --git a/feed.json b/feed.json index bacc422..bc45520 100644 --- a/feed.json +++ b/feed.json @@ -1,4 +1,10 @@ [ + { + "content": "# TypeScript: ElementRef for React.useRef\n\nYou can extract the type from a `useRef` hook using `ElementRef`:\n\n```tsx\nimport { useRef, ElementRef } from \"react\";\n \nconst Component = () => {\n const audioRef = useRef>(null);\n// ^? React.RefObject\n\n return ;\n};\n```\n\nRead [Matt Pocock's Strongly Type useRef with ElementRef](https://www.totaltypescript.com/strongly-type-useref-with-elementref).", + "date": "2024-01-03", + "path": "ts-react-elementref.md", + "title": "TypeScript: ElementRef for React.useRef" + }, { "content": "# Null is a billion-dollar mistake\n\nIn 2009, Tony Hoare describes his invention as a \"billion-dollar mistake\":\n\n> I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.\n\n## Reading\n\n- https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare/\n- https://en.wikipedia.org/wiki/Null_pointer\n- https://en.wikipedia.org/wiki/Tony_Hoare\n- https://maximilianocontieri.com/null-the-billion-dollar-mistake", "date": "2024-01-02",