After two years of Rust, I'm doing this year in TypeScript. I started by asking
ChatGPT for help getting setup, but then I didn't follow it that closely because
I wanted to use modern tooling like pnpm, and it was inconsistent about giving
me modern recommendations. It was great for asking about why vscode didn't
recognize process and things like that, though. I later switched to bun based
on a recommendation from a colleague, and also changed vitest to bun:test.
First, install bun; this is a runtime (replaces nodejs) and a package manager (replaced npm/yarn/pnpm):
brew tap oven-sh/bun
brew install bunI started with a minimal setup (see git history). I generated the
package.json with pnpm init. I installed and added typescript and tsx with
pnpm install --save-dev typescript tsx. Eventually this moved to bun. You'll
need to run:
bun installFor vscode, I did need to change the package manager in the "npm" section to "pnpm" (then "bun") from "auto".
I also needed to run pnpm add -D @types/node, to teach typescript that it is
targeting node; this fixed vscode's tooling to recognize process as an
object. Later I switched to bun add -D @types/bun. I added the tsconfig from
https://bun.com/docs/typescript.
You can run a day with:
bun day 0Tests are run with:
bun testFor linting and formatting, I installed prettier and eslint. You can run them:
bun format && bun lintI used ChatGPT to help write some portions of the code, with lots of guidance.
This helped me not have to look up things like how to write log10.
To start up a REPL, type:
$ bun tsx
> const { Grid } = await import("./src/grid.ts");