Benjamin Lesné
benjaminlesne.bsky.social
Benjamin Lesné
@benjaminlesne.bsky.social
Web Developer | mainly with React

https://benjamin-lesne.dev/
🚀 The WLC Scenario Explorer is now LIVE!

This open-source tool explore different possible scenarios for whole life cycle greenhouse gas emissions of buildings across Europe.

More info below! 🧵👇
July 10, 2025 at 10:01 AM
TIL: CTRL + ALT + R toggles Reader View in Firefox, switching from a white background to a dark, clutter-free version, way easier to read!

Not all sites support it, though. Not sure how it decides. 🤔
January 30, 2025 at 9:59 AM

@mattpocock.com I just took your quiz, how did I do? 👀 What's the average score? I'm curious to know where I stand!

The quiz 👉 totaltypescript.com/wizard-quiz
January 24, 2025 at 8:06 PM
When navigating to /about#author with scroll-behavior: smooth, I landed 100px above my author section.

Turns out my images were not loaded yet when the browser calculated where to scroll to.

To fix this you need to provide a width and height to your img tag to prevent reflows and repaints
January 3, 2025 at 3:49 PM
Oops, you just messed up your Line Graph's Y-axis!

No TypeScript warning, no runtime error, now it’s just you and your half-empty Line graph.

Should be fixed in v3 🤞

demo here: codesandbox.io/p/sandbox/xy...

#recharts
December 25, 2024 at 8:47 PM
DAY 19 ✅ adventofts.com/events/2024/19

Shoutout to my Copilot free plan for making today’s challenge beatable 😂

#spoiler
December 19, 2024 at 8:40 PM
And of course, Dominik's solution using NoInfer is much better 😂

With NoInfer, we basically say: don't use the defaultColor variable to infer the Color type.

📽️ Learn NoInfer: youtube.com/watch?v=mkuChhuHO50

Dominik's repo: github.com/TkDodo/advent-of-typescript/blob/main/2024/18.ts
December 18, 2024 at 10:13 PM
DAY 18 ✅ adventofts.com/events/2024/18

Slowly sharpening my TypeScript skills 🔪

#spoiler
December 18, 2024 at 9:55 PM
DAY 17 ✅ adventofts.com/events/2024/17

TIL how to make intrinsic types:
📽️ youtube.com/watch?v=B3LDiHl7pBI

Not gonna lie, I had to take a little peek at the answer to get unstuck.. Don’t judge me! 🙈

#spoiler
December 17, 2024 at 5:53 PM
DAY 16 ❌ www.adventofts.com/events/2024/16

TIL Partial<['1', '2', '3']> preserves the order of elements in the array, meaning we can't assign ['2', '3'] to it. Super useful for creating the "Magic Curry"

Solution from @tkdodo.eu below 👇
github.com/TkDodo/adven...

#spoiler
December 16, 2024 at 9:00 PM
@sachagreif.com I couldn’t DM you, so here I am:

looks like the backend section is missing its label 😬

2024.stateofjs.com/en-US/other-...
December 16, 2024 at 8:45 PM
DAY 15 ✅ adventofts.com/events/2024/15

If you’ve got a more elegant solution, I’d love to see it!

#spoiler
December 15, 2024 at 7:49 PM
December 14, 2024 at 2:13 PM
TIL about branded types in TypeScript
It allows you to give a meaningful type name to a variable typed as "string"

Now every time I see EmailAddress, I know it is an email for sure

📽️ Source video: www.youtube.com/watch?v=rpw5...
December 13, 2024 at 10:32 PM
DAY 13 ✅ adventofts.com/events/2024/13

TIL about the in and out keywords in TypeScript!

👇This video cleared up co/contra/bi/in-variant types for me and made me discover the in/out keywords

🎥 www.youtube.com/watch?v=bWF0...
The author: x.com/andrew8088

#spoiler
December 13, 2024 at 5:43 PM
DAY 12 ✅ adventofts.com/events/2024/12

The "Names" type with 300k+ values made my PC cough
Just hovering over the type took a solid 20 seconds to display the annotation 🫠

#spoiler #typescript
December 13, 2024 at 3:46 PM
DAY 11 ✅ adventofts.com/events/2024/11

TIL how to type the "new" in a class

#spoiler #typescript
December 11, 2024 at 2:11 PM
DAY 10 ✅ adventofts.com/events/2024/10

TIL about the left shift operator (<<) and hope I will never use it again lmao

#spoiler
December 10, 2024 at 11:13 AM
DAY 9 ✅ adventofts.com/events/2024/9

TIL how to declare types for untyped third-party packages

#spoiler
December 9, 2024 at 4:33 PM
DAY 8 ✅ adventofts.com/events/2024/8

I learned how to type env variables here:
www.totaltypescript.com/how-to-stron...

#spoiler
December 8, 2024 at 11:15 AM
DAY 7 ✅

To be honest, I don’t use const like this very often.
Spent way more time on it than I’d like to admit 😬

#spoiler
adventofts.com/events/2024/7
December 7, 2024 at 9:54 PM
DAY 6 ✅

adventofts.com/events/2024/6

Careful, #spoiler!

To avoid seeing the spoiler you can subscribe to spoiler droid here:
bsky.app/profile/did:...
December 6, 2024 at 3:34 PM
DAY 5 ✅
Answer below careful #spoiler

adventofts.com/events/2024/5
December 5, 2024 at 2:48 PM
December 5, 2024 at 2:46 PM
Today I got hit with:
ReferenceError: can't access lexical declaration myVar before initialization

...with no ESLint or TypeScript errors.
Turns out I had circular dependencies

I used Madge to spot them:
madge ./src/main.tsx -c

You can also generate graphs!

Madge repo: github.com/pahen/madge
November 29, 2024 at 10:43 AM