Loading video...

Video Failed to Load

Go Home

Every time I post this, I get so many WTF's in the comments. It's the 'string & {}' trick. Still absolutely essential for getting 'loose autocomplete' in library code.

77,748 views • 1 year ago •via X (Twitter)

11 Comments

Matt Pocock's profile picture
Matt Pocock1 year ago

My course is the bomb, if bombs were 30% off

SecBriefs | Making Cybersecurity Simple's profile picture
SecBriefs | Making Cybersecurity Simple2 years ago

🧠Studying for #CompTIA #Security+ but struggling with #Cybersecurity terms?🔍 Cybersecurity Dictionary for Everyone covers everything you need to know and is available on Amazon!🔐 🚀Boost your Security+ prep with it today!💡

Panta's profile picture
Panta1 year ago

Super cool! I was curious so I gave it a try - it seems to also work with a String constructor!

Renato Carneiro's profile picture
Renato Carneiro1 year ago

type DontFuckMyAutoComplete<T extends string> = T | (string & {}); type Model = DontFuckMyAutoComplete <“gpt-4o” | “gemini”>;

Michael Feldstein's profile picture
Michael Feldstein1 year ago

great explanation of why this works

Cory Simmons's profile picture
Cory Simmons1 year ago

I'm not going to learn anything else about Typescript. I'm just going to have AI do it and hope it works. Tired of all this goofy stuff

Tom Duncalf's profile picture
Tom Duncalf1 year ago

Haha that's wild. Had no idea this was possible. Nice explanation :)

Akaam Shamerany's profile picture
Akaam Shamerany1 year ago

TIL

Ryan Rampersad's profile picture
Ryan Rampersad1 year ago

For a second there, I thought that was a Rust syntax trick you were sharing

Light's profile picture
Light1 year ago

Ok nice

shaqcn's profile picture
shaqcn1 year ago

WTF

Related Videos