Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Aug 15, 2023
0 parents commit b71beae
Show file tree
Hide file tree
Showing 194 changed files with 11,895 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI
on:
push:
branches:
- "**"

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm run ci
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.vscode
tsconfig.temp.json
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<a href="https://totaltypescript.com/tutorials/react-with-typescript"><img src="https://res.cloudinary.com/total-typescript/image/upload/v1683647787/react-with-typescript_p2dgf5.png" alt="React with TypeScript, tutorial by Matt Pocock" /></a>

## Quickstart

Clone this repo or [open in Gitpod](https://gitpod.io/#https://github.com/total-typescript/react-typescript-tutorial).

```sh
# Installs all dependencies
npm install

# Starts the first exercise
npm run exercise 01

# Runs linting and tests on the solution
npm run solution 01
```

## How to take the course

You'll notice that the course is split into exercises. Each exercise is split into a `*.problem.ts` and a `*.solution.ts`.

To take an exercise:

1. Go into `*.problem.ts`
2. Run `npm run exercise 01`, where `01` is the number of the exercise you're on.

The `exercise` script will run TypeScript typechecks and a test suite on the exercise.

This course encourages **active, exploratory learning**. In the video, I'll explain a problem, and **you'll be asked to try to find a solution**. To attempt a solution, you'll need to:

1. Check out [TypeScript's docs](https://www.typescriptlang.org/docs/handbook/intro.html) or the [React TypeScript cheatsheet](https://react-typescript-cheatsheet.netlify.app/)
1. Try to find something that looks relevant.
1. Give it a go to see if it solves the problem.

You'll know if you've succeeded because the tests will pass.

**If you succeed**, or **if you get stuck**, unpause the video and check out the `*.solution.ts`. You can see if your solution is better or worse than mine!

You can run `npm run solution 01` to run the tests and typechecking on the solution.

## Acknowledgements

Say thanks to Matt on [Twitter](https://twitter.com/mattpocockuk) or by joining his [Discord](https://discord.gg/8S5ujhfTB3). Consider signing up to his [Total TypeScript course](https://totaltypescript.com).

## Reference

### `npm run exercise 01`

Alias: `npm run e 01`

Run the corresponding `*.problem.ts` file.

### `npm run solution 01`

Alias: `npm run s 01`

Run the corresponding `*.solution.ts` file. If there are multiple, it runs only the first one.
Binary file added og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
213 changes: 213 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
{
"name": "total-typescript-book",
"version": "1.0.0",
"main": "index.js",
"author": "Matt Pocock <[email protected]>",
"license": "GPL",
"devDependencies": {
"@total-typescript/exercise-cli": "^0.2.2",
"cross-fetch": "^3.1.5",
"jsdom": "^21.1.1",
"prettier": "^2.8.7",
"typescript": "^5.1.3",
"vite-tsconfig-paths": "^4.0.7",
"vitest": "^0.31.1"
},
"scripts": {
"exercise": "tt-cli run",
"e": "npm run exercise",
"solution": "tt-cli run --solution",
"s": "npm run solution",
"ci": "(cd scripts/tests && npx vitest run)",
"update-snapshots": "(cd scripts/tests && npx vitest run -u)",
"prepare": "tt-cli prepare-stackblitz",
"e-09": "tt-cli run 09",
"s-09": "tt-cli run 09 --solution",
"e-10": "tt-cli run 10",
"s-10": "tt-cli run 10 --solution",
"e-18": "npm run exercise -- 18",
"s-18": "npm run solution -- 18",
"e-19": "tt-cli run 19",
"s-19": "tt-cli run 19 --solution",
"e-20": "tt-cli run 20",
"s-20": "tt-cli run 20 --solution",
"e-21": "tt-cli run 21",
"s-21": "tt-cli run 21 --solution",
"e-22": "tt-cli run 22",
"s-22": "tt-cli run 22 --solution",
"e-26": "tt-cli run 26",
"s-26": "tt-cli run 26 --solution",
"e-28": "tt-cli run 28",
"s-28": "tt-cli run 28 --solution",
"e-12": "tt-cli run 12",
"s-12": "tt-cli run 12 --solution",
"e-14": "tt-cli run 14",
"s-14": "tt-cli run 14 --solution",
"e-32": "tt-cli run 32",
"s-32": "tt-cli run 32 --solution",
"e-33": "tt-cli run 33",
"s-33": "tt-cli run 33 --solution",
"e-34": "tt-cli run 34",
"s-34": "tt-cli run 34 --solution",
"e-35": "tt-cli run 35",
"s-35": "tt-cli run 35 --solution",
"e-39": "tt-cli run 39",
"s-39": "tt-cli run 39 --solution",
"e-36": "tt-cli run 36",
"s-36": "tt-cli run 36 --solution",
"e-40": "tt-cli run 40",
"s-40": "tt-cli run 40 --solution",
"e-03": "tt-cli run 03",
"s-03": "tt-cli run 03 --solution",
"e-04": "tt-cli run 04",
"s-04": "tt-cli run 04 --solution",
"e-05": "tt-cli run 05",
"s-05": "tt-cli run 05 --solution",
"e-06": "tt-cli run 06",
"s-06": "tt-cli run 06 --solution",
"e-07": "tt-cli run 07",
"s-07": "tt-cli run 07 --solution",
"e-08": "tt-cli run 08",
"s-08": "tt-cli run 08 --solution",
"e-11": "tt-cli run 11",
"s-11": "tt-cli run 11 --solution",
"e-13": "tt-cli run 13",
"s-13": "tt-cli run 13 --solution",
"e-15": "tt-cli run 15",
"s-15": "tt-cli run 15 --solution",
"e-16": "tt-cli run 16",
"s-16": "tt-cli run 16 --solution",
"e-17": "tt-cli run 17",
"s-17": "tt-cli run 17 --solution",
"e-23": "tt-cli run 23",
"s-23": "tt-cli run 23 --solution",
"e-24": "tt-cli run 24",
"s-24": "tt-cli run 24 --solution",
"e-25": "tt-cli run 25",
"s-25": "tt-cli run 25 --solution",
"e-27": "tt-cli run 27",
"s-27": "tt-cli run 27 --solution",
"e-29": "tt-cli run 29",
"s-29": "tt-cli run 29 --solution",
"e-30": "tt-cli run 30",
"s-30": "tt-cli run 30 --solution",
"e-31": "tt-cli run 31",
"s-31": "tt-cli run 31 --solution",
"e-37": "tt-cli run 37",
"s-37": "tt-cli run 37 --solution",
"e-38": "tt-cli run 38",
"s-38": "tt-cli run 38 --solution",
"e-41": "tt-cli run 41",
"s-41": "tt-cli run 41 --solution",
"e-44": "tt-cli run 44",
"s-44": "tt-cli run 44 --solution",
"e-46": "tt-cli run 46",
"s-46": "tt-cli run 46 --solution",
"e-47": "tt-cli run 47",
"s-47": "tt-cli run 47 --solution",
"e-48": "tt-cli run 48",
"s-48": "tt-cli run 48 --solution",
"e-49": "tt-cli run 49",
"s-49": "tt-cli run 49 --solution",
"e-50": "tt-cli run 50",
"s-50": "tt-cli run 50 --solution",
"e-51": "tt-cli run 51",
"s-51": "tt-cli run 51 --solution",
"e-54": "tt-cli run 54",
"s-54": "tt-cli run 54 --solution",
"e-55": "tt-cli run 55",
"s-55": "tt-cli run 55 --solution",
"e-56": "tt-cli run 56",
"s-56": "tt-cli run 56 --solution",
"e-57": "tt-cli run 57",
"s-57": "tt-cli run 57 --solution",
"e-58": "tt-cli run 58",
"s-58": "tt-cli run 58 --solution",
"e-59": "tt-cli run 59",
"s-59": "tt-cli run 59 --solution",
"e-60": "tt-cli run 60",
"s-60": "tt-cli run 60 --solution",
"e-61": "tt-cli run 61",
"s-61": "tt-cli run 61 --solution",
"e-62": "tt-cli run 62",
"s-62": "tt-cli run 62 --solution",
"e-63": "tt-cli run 63",
"s-63": "tt-cli run 63 --solution",
"e-42": "tt-cli run 42",
"s-42": "tt-cli run 42 --solution",
"e-45": "tt-cli run 45",
"s-45": "tt-cli run 45 --solution",
"e-52": "tt-cli run 52",
"s-52": "tt-cli run 52 --solution",
"e-64": "tt-cli run 64",
"s-64": "tt-cli run 64 --solution",
"e-65": "tt-cli run 65",
"s-65": "tt-cli run 65 --solution",
"e-66": "tt-cli run 66",
"s-66": "tt-cli run 66 --solution",
"e-43": "tt-cli run 43",
"s-43": "tt-cli run 43 --solution",
"e-67": "tt-cli run 67",
"s-67": "tt-cli run 67 --solution",
"e-68": "tt-cli run 68",
"s-68": "tt-cli run 68 --solution",
"e-70": "tt-cli run 70",
"s-70": "tt-cli run 70 --solution",
"e-71": "tt-cli run 71",
"s-71": "tt-cli run 71 --solution",
"e-73": "tt-cli run 73",
"s-73": "tt-cli run 73 --solution",
"e-69": "tt-cli run 69",
"s-69": "tt-cli run 69 --solution",
"e-74": "tt-cli run 74",
"s-74": "tt-cli run 74 --solution",
"e-76": "tt-cli run 76",
"s-76": "tt-cli run 76 --solution",
"e-020": "tt-cli run 020",
"s-020": "tt-cli run 020 --solution",
"e-022": "tt-cli run 022",
"s-022": "tt-cli run 022 --solution",
"e-023": "tt-cli run 023",
"s-023": "tt-cli run 023 --solution",
"e-024": "tt-cli run 024",
"s-024": "tt-cli run 024 --solution",
"e-025": "tt-cli run 025",
"s-025": "tt-cli run 025 --solution",
"e-026": "tt-cli run 026",
"s-026": "tt-cli run 026 --solution",
"e-027": "tt-cli run 027",
"s-027": "tt-cli run 027 --solution",
"e-028": "tt-cli run 028",
"s-028": "tt-cli run 028 --solution",
"e-029": "tt-cli run 029",
"s-029": "tt-cli run 029 --solution",
"e-030": "tt-cli run 030",
"s-030": "tt-cli run 030 --solution",
"e-031": "tt-cli run 031",
"s-031": "tt-cli run 031 --solution",
"e-032": "tt-cli run 032",
"s-032": "tt-cli run 032 --solution",
"e-033": "tt-cli run 033",
"s-033": "tt-cli run 033 --solution",
"e-034": "tt-cli run 034",
"s-034": "tt-cli run 034 --solution",
"e-035": "tt-cli run 035",
"s-035": "tt-cli run 035 --solution",
"e-036": "tt-cli run 036",
"s-036": "tt-cli run 036 --solution",
"e-037": "tt-cli run 037",
"s-037": "tt-cli run 037 --solution"
},
"dependencies": {
"@tanstack/react-query": "^4.29.12",
"@types/express": "^4.17.13",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
"express": "^4.18.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.44.3",
"react-select": "^5.7.3",
"zod": "^3.21.4"
}
}
Loading

0 comments on commit b71beae

Please sign in to comment.