Advent of TypeScript Play-Through! Days 1 - 13

Поделиться
HTML-код
  • Опубликовано: 15 дек 2023
  • Chapters
    - Day 1 - 0:46
    - Day 2 - 1:50
    - Day 3 - 2:40
    - Day 4 - 3:34
    - Day 5 - 5:00
    - Day 6 - 7:18
    - Day 7 - 11:01
    - Day 8 - 14:58
    - Day 9 - 17:19
    - Day 10 - 21:52
    - Day 11 - 23:30
    - Day 12 - 28:16
    - Day 13 - 33:29
    - Conclusion - 46:52
    Advent of TypeScript: typehero.dev/aot-2023
    Distributive Conditional Types: shaky.sh/ts-distributive-cond...
    Thanks to @MichiganTypeScript for all the challenges in this video!
    My Links
    shaky.sh
    shaky.sh/tools
    / andrew8088
    mastodon.social/@andrew8088
    #programming #coding #typescript #javascript #adventofcode
    #frontenddeveloper #backenddeveloper #softwareengineer #softwareengineering #softwaredevelopment
  • НаукаНаука

Комментарии • 25

  • @dimitrimitropoulos
    @dimitrimitropoulos 6 месяцев назад +8

    ❤ hope everyone enjoys them! It was super fun writing the prompts but I got to say: there are many many other people involved with making typehero into what it has become in such a short span of time!

  • @mettle_x
    @mettle_x 6 месяцев назад +7

    21:50 You can do it without an accumulator like this:
    type Reverse =
    T extends `${infer First}${infer Rest}` ?
    `${Reverse}${First}`
    : T;

  • @muzikant1986
    @muzikant1986 6 месяцев назад +3

    13 day can be done with small amount of code
    type DayCounter = V extends Array<
    infer O
    >
    ? T extends U
    ? O
    : DayCounter
    : never;

  • @Tommy-ev6gv
    @Tommy-ev6gv 6 месяцев назад +1

    5:19 love the Primagen reference.

  • @mettle_x
    @mettle_x 6 месяцев назад +2

    14:51 You can exclude symbol from K like this: `good_${K extends Exclude ? K : never}`

  • @ChillAutos
    @ChillAutos 6 месяцев назад +1

    This is brilliant. I’d love to watch you do more advent of code challenges in typescript.

  • @juanferrer5885
    @juanferrer5885 6 месяцев назад

    I couldn't enjoy more this type of code challenge videos! I would love to see more of this. Maybe not just type only. great video!

  • @helleye311
    @helleye311 6 месяцев назад

    "Type instantiation is excessively deep" is my worst enemy when doing fun typescript stuff.
    I've often mapped types to other types recursively, and since the initial type can be nested objects I do technically need to recurse infinitely, but in practice with concrete types that nest 2-3 layers deep it should still work. I wish TS didn't consider the generic when doing the recursion depth check, just concrete types that come out.

  • @ludatim7864
    @ludatim7864 6 месяцев назад

    Wow, such a nice idea!

  • @metinsut
    @metinsut 6 месяцев назад

    thanks

  • @kzinthant_
    @kzinthant_ 6 месяцев назад +1

    I used Exclude for day 6

  • @obifortune
    @obifortune 6 месяцев назад +1

    You can just do T["length"] to get the length of a tuple!

  • @dinckelman
    @dinckelman 6 месяцев назад +2

    You know you’ve succeeded as a dev, when you refer to your own blog posts for info hahaha

    • @ChillAutos
      @ChillAutos 6 месяцев назад

      This was exactly what I thought to haha

  • @obifortune
    @obifortune 6 месяцев назад +2

    i was able to get away with something really short for the day13(still has recursion lol)
    ```ts
    type DayCounter<
    F extends number,
    L extends number,
    R extends readonly number[] = [1],
    > = R["length"] extends L
    ? R[number] | L
    : DayCounter;
    ```

  • @jaideepsingh8449
    @jaideepsingh8449 Месяц назад

    Hey buddy, i saw your advent of typescript series, i am beginer, I got stuck in one of the similar code which uses advent of typescript logics, could you please help me out?

  • @lqueryvg
    @lqueryvg 6 месяцев назад

    for day 10 you can write "string" instead of "infer _" - I think it makes more sense

  • @marcush3997
    @marcush3997 6 месяцев назад

    type IsObject = P extends Function? never : P extends object? P: never;
    type SantaListProtector = {
    readonly [K in keyof T]: T[K] extends IsObject? SantaListProtector: T[K]
    };
    a spin on the explicit solution but not sure if there's hidden issue with this

  • @andrew1550
    @andrew1550 6 месяцев назад

    Real vim pros map capslock to the escape key.

    • @andrew-burgess
      @andrew-burgess  6 месяцев назад

      Yeah, that's good too. I map capslock to control.