TypeScript
Learn how to solve CodeCrafters challenges in TypeScript
Local development
To run the code for your challenge locally, you’ll need bun
installed. Our test runners use Bun v1.1 (as of May 2024).
The script for your challenge (like ./your_grep.sh
) will run your code using this version of bun
. It’ll
look something like this:
File structure
- The files for your solution are placed in the
app/
directory. app/main.ts
is the entrypoint for the program.
Adding more files
You can add more files and directories to app/
. The test runner will include them when compiling your code.
For example, if you add a file at app/foo.ts
, you could use it like so:
Refer to the Bun documentation for additional details.
Remember to add the export
keyword to functions and variables that you want
to export.
Adding dependencies
You can add dependencies to your project using bun add
.
For example, to add zod
as a dependency, run the following command:
This will add the following line to your package.json
file:
It will also update the bun.lockb
file.