Skip to content

Repository with the solutions of Advent of TypeScript (2024), types challenges, by @typehero.

License

Notifications You must be signed in to change notification settings

hozlucas28/AdventTS-Solutions-2024

Repository files navigation

AdventTS Solutions [2024] 🎅🎄

Repository of Advent of TypeScript, types challenges, by Typehero.

SummaryInstallationChallengesRelatedLicenseAcknowledgmentsContact

Summary

This repository serves as a housing solutions to types challenges of Advent of TypeScript. AdventTS, a project developed by Typehero, offers a platform for developers to improve their type definitions skills, through a series of daily challenges spanning 25 days. The challenge begins on December 1st and culminates on December 25th.

Installation

  1. Clone the repository.
  2. Install the latest version of Node.js and globally install pnpm.
  3. Navigate to the directory where you cloned the repository with your favorite CLI.
  4. Run pnpm install in your CLI to install all necessary packages.
  5. Finally, run pnpm test in your CLI to execute all challenges/tests.

Note: If you want to run a specific challenge/test, execute pnpm run test:challenge<number> (challenge 11, 13, and 16 are not testable).

Challenges

# Challenge Difficulty Description
01 Introduction to the Advent of TypeScript platform 🟢 Show
02 Create a type which returns a literal number 🟢 Show
03 Change the data type of the parameter for only allow numbers 🟢 Show
04 Change the data type of the parameter for only allow numbers or strings 🟢 Show
05 Change the data type of the function to return the same data type which it receives (without specifying it) 🟢 Show
06 Change the data type of the function to return the same data type which it receives (without specifying it), but only allowing numbers or strings 🟢 Show
07 Infer the literal data type of a function parameter 🟢 Show
08 Extend global types of NodeJS environment variables 🟢 Show
09 Add types to the third party NPM package 🟢 Show
10 Create an enum which contains bitwise operators 🟢 Show
11 Create a data type for a new object using the "new" reserved name 🟠 Show
12 Format the names without recursion and checking if name length is even or odd (only with types) 🔴 Show
13 Apply the concepts of Covariant, Contravariant, and Invariant on types 🟠 Show
14 Get the possible return types of the function generators 🟢 Show
15 Get the fuel needed to travel between locations 🔴 Show
16 Create a currying function type declaration 🟠 Show
17 Infer the literal return type of a compose function 🟠 Show
18 Prevent infer of the second argument and only allowing the literal types of the first argument 🟢 Show
19 Extract variable declarations and function calls to an object 🟠 Show
20 Extract variable declarations and function arguments to an object 🟠 Show
21 Improve the challenge 20 to include unused variable declarations 🟢 Show

Related

License

This repository is under MIT License, if you want to see what you are allowed to do with the content of this repository, please visit choosealicense for more information.

Acknowledgments

Thanks to Typehero team to develop Advent of TypeScript.

Contact

If you want to contact me, please see my socials medias in my GitHub profile.