Preserving AutoComplete for Literal Unions // Advanced TypeScript Tutorial

Опубликовано: 26 Июль 2026
на канале: basarat
3,125
155

When you are working on a design system component library its not uncommon to have a property as a limited set of literal strings as well as open to all string values to allow consumer customization, sadly its not easy to annotate this in TypeScript without messing up autocomplete and that is what we will demo and fix in this tutorial, so lets go 🌹

🚥 Professional Courses
https://www.booleanart.com/

Part of the Free Advanced TypeScript Series:
   • Advanced TypeScript Tutorials  

Final Code On Github: https://github.com/basarat/demo-liter...

🏷 #basarat #5MinutesOrLess #TypeScript #JavaScript #Tutorial #Advanced

👇 ❤️ Subscribe for MOORE ❤️ 👇
https://www.youtube.com/basaratali?su...

*Feel Free To Read This Lot*

I'm Basarat, and I love helping developers. More about me:

Microsoft MVP for TypeScript
200K contributions on Stackoverflow. Top Contributor for TypeScript.
Udemy Courses: https://www.udemy.com/user/basaratali...
Creator https://designtsx.com
Book Author: Beginning NodeJS
Book Author: TypeScript Deep Dive
Egghead Instructor: https://egghead.io/q/resources-by-bas...
Creator of multiple hot ✨ed Github Open Source projects

Follow me on Twitter:   / basarat  
Follow me on GitHub: https://github.com/basarat
Donate: https://www.paypal.me/basaratali
Content Creation Kit (Camera / Lens etc.): https://kit.co/basarat/content-creation
Join to support the channel:    / basaratali  

Website: https://basarat.com/