Syntax - Tasty Web Development Treats

Hasty Treat - TypeScript Utility Types


Listen Later

In this Hasty Treat, Scott and Wes talk about TypeScript utility types — what they are, why you might use them, why they exist, and more!

Linode - Sponsor

Whether you’re working on a personal project or managing enterprise infrastructure, you deserve simple, affordable, and accessible cloud computing solutions that allow you to take your project to the next level. Simplify your cloud infrastructure with Linode’s Linux virtual machines and develop, deploy, and scale your modern applications faster and easier. Get started on Linode today with a $100 in free credit for listeners of Syntax. You can find all the details at linode.com/syntax. Linode has 11 global data centers and provides 24/7/365 human support with no tiers or hand-offs regardless of your plan size. In addition to shared and dedicated compute instances, you can use your $100 in credit on S3-compatible object storage, Managed Kubernetes, and more. Visit linode.com/syntax and click on the “Create Free Account” button to get started.

LogRocket - Sponsor

LogRocket lets you replay what users do on your site, helping you reproduce bugs and fix issues faster. It’s an exception tracker, a session re-player and a performance monitor. Get 14 days free at logrocket.com/syntax.

Show Notes

03:35 - Levels of using TypeScript

  1. Typing your code
  2. Typing your code, but getting a little bit more dynamic using utility types
  3. Creating your own utility types!
  • TypeScript is a language in itself
  • Check out type challenges if you want your mind blown: https://github.com/type-challenges/type-challenges/
  • https://www.typescriptlang.org/docs/handbook/utility-types.html

07:29 - Partial

08:23 - ReadOnly

09:00 - Required

09:33 - Record

  • A record is an object type that is a bit more restrictive
  • Say you want to store podcast details - name, URL, showCount, etc., but only for Syntax and Shoptalk.

10:47 - Omit

  • I find this one handy when I want to create a “Create Item” type, where it has all the item fields except the ID field

11:34 - Pick

  • Given a type, pick these properties

12:39 - Return Types

  • Gives you the type that is returned from a function. Handy if you need to dynamically generate the type based on a passed function.

13:30 - Case

  • These case types are useful for when you are doing template literal types
  • Uppercase
  • Lowercase
  • Capitalize
  • Uncapitalize
Tweet us your tasty treats!
  • Scott’s Instagram
  • LevelUpTutorials Instagram
  • Wes’ Instagram
  • Wes’ Twitter
  • Wes’ Facebook
  • Scott’s Twitter
  • Make sure to include @SyntaxFM in your tweets
...more
View all episodesView all episodes
Download on the App Store

Syntax - Tasty Web Development TreatsBy Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

  • 4.9
  • 4.9
  • 4.9
  • 4.9
  • 4.9

4.9

966 ratings


More shows like Syntax - Tasty Web Development Treats

View all
Hanselminutes with Scott Hanselman by Scott Hanselman

Hanselminutes with Scott Hanselman

377 Listeners

Software Engineering Radio - the podcast for professional software developers by se-radio@computer.org

Software Engineering Radio - the podcast for professional software developers

265 Listeners

.NET Rocks! by Carl Franklin and Richard Campbell

.NET Rocks!

245 Listeners

The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

285 Listeners

Thoughtworks Technology Podcast by Thoughtworks

Thoughtworks Technology Podcast

40 Listeners

Talk Python To Me by Michael Kennedy

Talk Python To Me

586 Listeners

Software Engineering Daily by Software Engineering Daily

Software Engineering Daily

629 Listeners

Soft Skills Engineering by Jamison Dance and Dave Smith

Soft Skills Engineering

275 Listeners

Python Bytes by Michael Kennedy and Brian Okken

Python Bytes

213 Listeners

The freeCodeCamp Podcast by freeCodeCamp.org

The freeCodeCamp Podcast

484 Listeners

CoRecursive: Coding Stories by Adam Gordon Bell - Software Developer

CoRecursive: Coding Stories

186 Listeners

The Stack Overflow Podcast by The Stack Overflow Podcast

The Stack Overflow Podcast

63 Listeners

The Real Python Podcast by Real Python

The Real Python Podcast

136 Listeners

PodRocket - A web development podcast from LogRocket by LogRocket

PodRocket - A web development podcast from LogRocket

58 Listeners

The Pragmatic Engineer by Gergely Orosz

The Pragmatic Engineer

52 Listeners