Logo
    Search

    code efficiency

    Explore "code efficiency" with insightful episodes like "TypeScript Fundamentals × Type Narrowing, Guards, and Predicates", "Hasty Treat - Handy Utility Functions with Just", "Hasty Treat - TypeScript Utility Types" and "Top 18 New Things in JS - Part 1" from podcasts like ""Syntax - Tasty Web Development Treats", "Syntax - Tasty Web Development Treats", "Syntax - Tasty Web Development Treats" and "Syntax - Tasty Web Development Treats"" and more!

    Episodes (4)

    TypeScript Fundamentals × Type Narrowing, Guards, and Predicates

    TypeScript Fundamentals × Type Narrowing, Guards, and Predicates

    In this episode of Syntax, Wes and Scott talk through some TypeScript Fundamentals around type narrowing, type guards, and type predicates.

    Show Notes

    Shameless Plugs

    Tweet us your tasty treats

    Hasty Treat - Handy Utility Functions with Just

    Hasty Treat - Handy Utility Functions with Just

    In this Hasty Treat, Scott and Wes talk about handy utility functions with Just!

    Sanity - Sponsor

    Sanity.io is a real-time headless CMS with a fully customizable Content Studio built in React. Get a Sanity powered site up and running in minutes at sanity.io/create. Get an awesome supercharged free developer plan on sanity.io/syntax.

    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:44 - What is Just?

    06:46 - Some nice ones

    • just-safe-set → deeply setting dynamic object properties
      • set(data, 'a.long[0].path', value)
    • object-typeof
      • Why not use typeof?
        • Everything is an object
      • Why not use array.isArray?
        • Handy to have a switch statement
    • just-*-case
      • Camel, kebab, snake
    • just-compare

    10:54 - Why?

    • This is the NPM install of Stack Overflow copy+paste
    • Handy as hell
    • Battle-tested
      • Lots of ways to do simple stuff
      • Sometimes the simple stuff has weird edge cases - these are caught
    • Sometimes your checks can be messy
      • Check if an object is empty
      • 25 lines
      • Just install it

    12:05 - Other

    • Great to learn and test yourself
    • There are tests for each function
      • Run them
      • See them fail
      • Try and make it so all the tests pass without looking at the source

    Links

    Tweet us your tasty treats!

    Hasty Treat - TypeScript Utility Types

    Hasty Treat - TypeScript Utility Types

    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!

    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!

    Top 18 New Things in JS - Part 1

    Top 18 New Things in JS - Part 1

    In this episode Wes and Scott discuss their favorite top 18 new things in Javascript.

    Freshbooks - Sponsor

    Get a 30 day free trial of Freshbooks at freshbooks.com/syntax and put SYNTAX in the “How did you hear about us?” section.

    Mlab - Sponsor

    mLab is the leading Database-as-a-Service for MongoDB, powering over half a million deployments worldwide. Wes and Scott use mLab to host their own databases as well as take care of backups, security, scaling and performance. Try out a sandbox database on your next mongoDB project → https://mlab.com.

    Show Notes

    6:02

    • Const / Let

    10:00

    14:29

    • Object destructuring

    21:28

    • Array destructuring

    27:25

    • Function Param destructuring

    30:14

    36:24

    40:59

    • Object Computed Property Name

    43:42

    • Object Method Syntax

    Links

    ××× SIIIIICK ××× PIIIICKS ×××

    Shameless Plugs

    Tweet us your tasty treats!