Skip to content

Commit f72695c

Browse files
committed
Add TypeScript foundations track
1 parent 1b609af commit f72695c

52 files changed

Lines changed: 1627 additions & 106 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cpp-build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ jobs:
1616
with:
1717
python-version: "3.12"
1818

19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "22"
23+
1924
- name: Setup Go
2025
uses: actions/setup-go@v5
2126
with:
@@ -34,6 +39,9 @@ jobs:
3439
- name: Install Ruff
3540
run: python -m pip install ruff
3641

42+
- name: Install Node dependencies
43+
run: npm ci
44+
3745
- name: Run lint checks
3846
run: bash ./scripts/lint.sh
3947

@@ -48,6 +56,11 @@ jobs:
4856
with:
4957
python-version: "3.12"
5058

59+
- name: Setup Node
60+
uses: actions/setup-node@v4
61+
with:
62+
node-version: "22"
63+
5164
- name: Setup Go
5265
uses: actions/setup-go@v5
5366
with:
@@ -63,6 +76,9 @@ jobs:
6376
sudo apt update
6477
sudo apt install -y g++
6578
79+
- name: Install Node dependencies
80+
run: npm ci
81+
6682
- name: Verify repository
6783
run: bash ./scripts/verify-repo.sh
6884

@@ -80,6 +96,11 @@ jobs:
8096
with:
8197
python-version: "3.12"
8298

99+
- name: Setup Node
100+
uses: actions/setup-node@v4
101+
with:
102+
node-version: "22"
103+
83104
- name: Setup Go
84105
uses: actions/setup-go@v5
85106
with:
@@ -108,6 +129,10 @@ jobs:
108129
shell: pwsh
109130
run: g++ --version
110131

132+
- name: Install Node dependencies
133+
shell: pwsh
134+
run: npm ci
135+
111136
- name: Verify repository
112137
shell: pwsh
113138
run: powershell -ExecutionPolicy Bypass -File scripts\verify-repo.ps1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ __pycache__/
1414
*.pyc
1515
report.txt
1616
core_assessment_report.txt
17+
node_modules/

CONTRIBUTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Thank you for contributing to this repository.
88
- Prefer simple, readable examples over clever implementations.
99
- Use clear English for all text, comments, and instructions.
1010
- Maintain cross-platform compatibility (Windows MSYS2 + Linux).
11+
- Keep Node-based tooling simple and explicit when touching the TypeScript track.
1112

1213
## Workflow
1314

@@ -60,6 +61,7 @@ Run language lint checks with:
6061
- `bash ./scripts/lint.sh` (Bash)
6162

6263
These smoke checks also compile standalone C# exercises by generating temporary validation projects during the check.
64+
TypeScript checks restore Node dependencies from `package-lock.json`, compile with `tsc`, and execute the emitted JavaScript with `node`.
6365

6466
The public PowerShell and Bash scripts are thin wrappers over the shared Python automation core in `scripts/automation.py`. Curriculum validation and smoke target metadata live in `scripts/automation_manifest.json`.
6567

@@ -79,7 +81,7 @@ The public PowerShell and Bash scripts are thin wrappers over the shared Python
7981
- `## Checkpoint`
8082
- Every project or assessment checkpoint should include:
8183
- `README.md`
82-
- runnable entrypoint (`main.cs` + `.csproj`, `main.go`, or `main.py`)
84+
- runnable entrypoint (`main.cs` + `.csproj`, `main.go`, `main.py`, or `main.ts`)
8385
- the same learner goal, input/output shape, and acceptance expectations as the corresponding C++ checkpoint
8486
- required `## Learning Metadata` before `## Quick Run` with `Difficulty`, `Estimated Time`, `Prerequisites`, and `Learning Focus`
8587
- Every implemented level README should include required `## Learning Metadata` before `## Module Order` with `Difficulty`, `Estimated Time`, `Prerequisites`, and `Study Strategy`.
@@ -93,6 +95,7 @@ The public PowerShell and Bash scripts are thin wrappers over the shared Python
9395
- Every exercise file must contain complete, runnable content.
9496
- Avoid external dependencies and test frameworks for C++ modules.
9597
- Avoid external dependencies and test frameworks for non-C++ checkpoints.
98+
- Keep the TypeScript track on plain Node console programs; do not introduce browser, DOM, or framework dependencies.
9699
- Keep examples aligned with C++17.
97100
- Keep documentation in English and keep path names consistent with folder names.
98101
- Keep parity planning updated in `LANGUAGE_PARITY_MATRIX.md` when adding modules or checkpoints to non-C++ tracks.

LANGUAGE_PARITY_MATRIX.md

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
# Language Parity Matrix
22

3-
This matrix tracks module and checkpoint parity across C++, C#, Go, and Python.
3+
This matrix tracks module and checkpoint parity across C++, C#, Go, Python, and TypeScript.
44

55
- Canonical order is defined by the C++ track.
66
- Module and checkpoint parity now reach `04-expert` across all active tracks.
7+
- TypeScript is the newest incremental track with `01-foundations` implemented first.
78
- Status labels:
89
- `Done`: module implemented with example, exercises, and README.
910
- `Planned`: module not implemented yet, already queued in order.
1011

1112
## Foundations (`01-foundations`)
1213

13-
| Module | C++ | C# | Go | Python |
14-
| --- | --- | --- | --- | --- |
15-
| types-and-io | Done | Done | Done | Done |
16-
| operators-and-expressions | Done | Done | Done | Done |
17-
| control-flow | Done | Done | Done | Done |
18-
| functions | Done | Done | Done | Done |
19-
| arrays-and-vectors | Done | Done | Done | Done |
20-
| strings | Done | Done | Done | Done |
21-
| scope-and-lifetime-basics | Done | Done | Done | Done |
22-
| formatted-output-and-iomanip | Done | Done | Done | Done |
14+
| Module | C++ | C# | Go | Python | TypeScript |
15+
| --- | --- | --- | --- | --- | --- |
16+
| types-and-io | Done | Done | Done | Done | Done |
17+
| operators-and-expressions | Done | Done | Done | Done | Done |
18+
| control-flow | Done | Done | Done | Done | Done |
19+
| functions | Done | Done | Done | Done | Done |
20+
| arrays-and-vectors | Done | Done | Done | Done | Done |
21+
| strings | Done | Done | Done | Done | Done |
22+
| scope-and-lifetime-basics | Done | Done | Done | Done | Done |
23+
| formatted-output-and-iomanip | Done | Done | Done | Done | Done |
2324

2425
## Core (`02-core`)
2526

@@ -28,15 +29,16 @@ Current parity progress in non-C++ tracks:
2829
- C#: `6/6` modules complete
2930
- Go: `6/6` modules complete
3031
- Python: `6/6` modules complete
32+
- TypeScript: `0/6` modules complete, foundations delivered first
3133

32-
| Order | Module | C++ | C# | Go | Python |
33-
| --- | --- | --- | --- | --- | --- |
34-
| 1 | input-validation | Done | Done | Done | Done |
35-
| 2 | algorithms-basics | Done | Done | Done | Done |
36-
| 3 | file-io-basics | Done | Done | Done | Done |
37-
| 4 | sorting-and-searching | Done | Done | Done | Done |
38-
| 5 | maps-and-frequency-counting | Done | Done | Done | Done |
39-
| 6 | error-handling-and-defensive-programming | Done | Done | Done | Done |
34+
| Order | Module | C++ | C# | Go | Python | TypeScript |
35+
| --- | --- | --- | --- | --- | --- | --- |
36+
| 1 | input-validation | Done | Done | Done | Done | Planned |
37+
| 2 | algorithms-basics | Done | Done | Done | Done | Planned |
38+
| 3 | file-io-basics | Done | Done | Done | Done | Planned |
39+
| 4 | sorting-and-searching | Done | Done | Done | Done | Planned |
40+
| 5 | maps-and-frequency-counting | Done | Done | Done | Done | Planned |
41+
| 6 | error-handling-and-defensive-programming | Done | Done | Done | Done | Planned |
4042

4143
## Advanced and Expert
4244

@@ -45,28 +47,29 @@ Current parity progress in non-C++ tracks:
4547
- C#: `5/5` modules complete in `03-advanced`, `5/5` in `04-expert`
4648
- Go: `5/5` modules complete in `03-advanced`, `5/5` in `04-expert`
4749
- Python: `5/5` modules complete in `03-advanced`, `5/5` in `04-expert`
50+
- TypeScript: `03-advanced` and `04-expert` planned after foundations and core
4851

4952
### Advanced (`03-advanced`) - Current Expansion Queue
5053

51-
| Order | Module | C++ | C# | Go | Python |
52-
| --- | --- | --- | --- | --- | --- |
53-
| 1 | structs-and-classes | Done | Done | Done | Done |
54-
| 2 | constructors-and-invariants | Done | Done | Done | Done |
55-
| 3 | copy-and-move-semantics | Done | Done | Done | Done |
56-
| 4 | inheritance-and-polymorphism | Done | Done | Done | Done |
57-
| 5 | templates-basics | Done | Done | Done | Done |
54+
| Order | Module | C++ | C# | Go | Python | TypeScript |
55+
| --- | --- | --- | --- | --- | --- | --- |
56+
| 1 | structs-and-classes | Done | Done | Done | Done | Planned |
57+
| 2 | constructors-and-invariants | Done | Done | Done | Done | Planned |
58+
| 3 | copy-and-move-semantics | Done | Done | Done | Done | Planned |
59+
| 4 | inheritance-and-polymorphism | Done | Done | Done | Done | Planned |
60+
| 5 | templates-basics | Done | Done | Done | Done | Planned |
5861

5962
`04-expert` projects and assessments are now implemented across C#, Go, and Python.
6063

6164
### Expert (`04-expert`)
6265

63-
| Order | Module | C++ | C# | Go | Python |
64-
| --- | --- | --- | --- | --- | --- |
65-
| 1 | memory-management-and-raii | Done | Done | Done | Done |
66-
| 2 | smart-pointers-in-depth | Done | Done | Done | Done |
67-
| 3 | concurrency-basics | Done | Done | Done | Done |
68-
| 4 | performance-and-profiling-basics | Done | Done | Done | Done |
69-
| 5 | modularization-and-build-structure | Done | Done | Done | Done |
66+
| Order | Module | C++ | C# | Go | Python | TypeScript |
67+
| --- | --- | --- | --- | --- | --- | --- |
68+
| 1 | memory-management-and-raii | Done | Done | Done | Done | Planned |
69+
| 2 | smart-pointers-in-depth | Done | Done | Done | Done | Planned |
70+
| 3 | concurrency-basics | Done | Done | Done | Done | Planned |
71+
| 4 | performance-and-profiling-basics | Done | Done | Done | Done | Planned |
72+
| 5 | modularization-and-build-structure | Done | Done | Done | Done | Planned |
7073

7174
## Checkpoint Parity
7275

@@ -77,18 +80,18 @@ Status labels:
7780

7881
### Projects
7982

80-
| Checkpoint | C++ | C# | Go | Python |
81-
| --- | --- | --- | --- | --- |
82-
| 01-foundations | Done | Done | Done | Done |
83-
| 02-core | Done | Done | Done | Done |
84-
| 03-advanced | Done | Done | Done | Done |
85-
| 04-expert | Done | Done | Done | Done |
83+
| Checkpoint | C++ | C# | Go | Python | TypeScript |
84+
| --- | --- | --- | --- | --- | --- |
85+
| 01-foundations | Done | Done | Done | Done | Done |
86+
| 02-core | Done | Done | Done | Done | Planned |
87+
| 03-advanced | Done | Done | Done | Done | Planned |
88+
| 04-expert | Done | Done | Done | Done | Planned |
8689

8790
### Assessments
8891

89-
| Checkpoint | C++ | C# | Go | Python |
90-
| --- | --- | --- | --- | --- |
91-
| 01-foundations | Done | Done | Done | Done |
92-
| 02-core | Done | Done | Done | Done |
93-
| 03-advanced | Done | Done | Done | Done |
94-
| 04-expert | Done | Done | Done | Done |
92+
| Checkpoint | C++ | C# | Go | Python | TypeScript |
93+
| --- | --- | --- | --- | --- | --- |
94+
| 01-foundations | Done | Done | Done | Done | Done |
95+
| 02-core | Done | Done | Done | Done | Planned |
96+
| 03-advanced | Done | Done | Done | Done | Planned |
97+
| 04-expert | Done | Done | Done | Done | Planned |

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This repository teaches programming through small runnable examples and focused exercises.
66

7-
- Four active language tracks: C++, C#, Go, and Python.
7+
- Five active language tracks: C++, C#, Go, Python, and TypeScript.
88
- Shared concept naming across tracks for easier comparison.
99
- VS Code-first workflow, with scripts for Windows PowerShell and Bash.
1010

@@ -15,6 +15,7 @@ This repository teaches programming through small runnable examples and focused
1515
- [C# Guide](languages/csharp/README.md)
1616
- [Go Guide](languages/go/README.md)
1717
- [Python Guide](languages/python/README.md)
18+
- [TypeScript Guide](languages/typescript/README.md)
1819
2. Open the `01-foundations` roadmap for your selected language.
1920
3. Run one module example.
2021
4. Solve `exercises/01` and `exercises/02` in that module.
@@ -28,6 +29,7 @@ This repository teaches programming through small runnable examples and focused
2829
| C# | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
2930
| Go | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
3031
| Python | 01-foundations, 02-core, 03-advanced, 04-expert | 8/8 foundations modules, 6/6 core modules, 5/5 advanced modules, 5/5 expert modules, 4/4 projects, 4/4 assessments | Module and checkpoint parity complete through expert |
32+
| TypeScript | 01-foundations | 8/8 foundations modules, 1/4 projects, 1/4 assessments | Foundations launched; core and above planned |
3133

3234
Parity planning reference: [LANGUAGE_PARITY_MATRIX.md](LANGUAGE_PARITY_MATRIX.md)
3335

@@ -58,6 +60,13 @@ go run languages/go/01-foundations/types-and-io/example/main.go
5860
python languages/python/01-foundations/types-and-io/example/main.py
5961
~~~
6062

63+
### TypeScript
64+
65+
~~~bash
66+
npm run build:typescript
67+
node build/typescript/01-foundations/types-and-io/example/main.js
68+
~~~
69+
6170
## Repository Structure
6271

6372
~~~text
@@ -71,6 +80,7 @@ learn-programming-languages-with-examples/
7180
csharp/
7281
go/
7382
python/
83+
typescript/
7484
~~~
7585

7686
## Documentation Contract
@@ -95,7 +105,7 @@ A standardized `## Learning Metadata` block is required before `## Quick Run` fo
95105
Checkpoint artifacts under `languages/<language>/projects/*` and `languages/<language>/assessments/*` should mirror the corresponding C++ checkpoint style:
96106

97107
- `README.md`
98-
- runnable entrypoint (`main.cs` + `.csproj`, `main.go`, or `main.py`)
108+
- runnable entrypoint (`main.cs` + `.csproj`, `main.go`, `main.py`, or `main.ts`)
99109
- same learner goal, input/output shape, and acceptance expectations as the C++ version
100110

101111
## Example Commenting Standard
@@ -132,11 +142,11 @@ bash ./scripts/build-all.sh
132142
bash ./scripts/verify-repo.sh
133143
~~~
134144

135-
GitHub Actions validates links, README structure, module completeness, checkpoint completeness, documentation sync, C++ build, multi-language smoke checks, and Linux lint checks for C++, Python, Go, and C#.
145+
GitHub Actions validates links, README structure, module completeness, checkpoint completeness, documentation sync, compiled-language builds, multi-language smoke checks, and Linux lint checks for C++, Python, Go, C#, and TypeScript.
136146

137147
The public PowerShell and Bash scripts remain the supported entrypoints, but they now delegate to a shared Python automation core under `scripts/automation.py` backed by `scripts/automation_manifest.json`.
138148

139-
The multi-language smoke scripts also compile standalone C# exercises by generating temporary validation projects during the check.
149+
The multi-language smoke scripts also compile standalone C# exercises by generating temporary validation projects during the check and compile TypeScript foundations programs before executing their smoke targets.
140150

141151
## Contributing
142152

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# TypeScript 01 Foundations
2+
3+
This level mirrors the C++ foundations roadmap with explicit parsing and beginner-friendly TypeScript console programs.
4+
5+
## Learning Metadata
6+
7+
- Difficulty: Beginner.
8+
- Estimated Time: 3-5 hours across modules, project, and assessment.
9+
- Prerequisites: None; this is the entry level for the TypeScript track.
10+
- Study Strategy: Work in module order, build the track often, solve both exercises in each module, then finish the project and assessment.
11+
12+
## Module Order
13+
14+
1. [types-and-io](./types-and-io/README.md)
15+
2. [operators-and-expressions](./operators-and-expressions/README.md)
16+
3. [control-flow](./control-flow/README.md)
17+
4. [functions](./functions/README.md)
18+
5. [arrays-and-vectors](./arrays-and-vectors/README.md)
19+
6. [strings](./strings/README.md)
20+
7. [scope-and-lifetime-basics](./scope-and-lifetime-basics/README.md)
21+
8. [formatted-output-and-iomanip](./formatted-output-and-iomanip/README.md)
22+
23+
Track progress in [../CHECKLIST.md](../CHECKLIST.md).
24+
25+
## Study Tip
26+
27+
Solve the same module in C++ and TypeScript back to back so you can compare explicit parsing, type annotations, and data-structure ergonomics.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Arrays and Dynamic Lists
2+
3+
This module uses typed arrays to store, transform, and summarize groups of values.
4+
5+
## Learning Metadata
6+
7+
- Difficulty: Beginner.
8+
- Estimated Time: 20-35 minutes.
9+
- Prerequisites: 01-foundations/control-flow and 01-foundations/functions.
10+
- Cross-Language Lens: Compare vector, List<T>, slices, Python lists, and TypeScript arrays as different tradeoffs for dynamic sequence work.
11+
12+
## Quick Run
13+
14+
~~~bash
15+
npm run build:typescript
16+
node build/typescript/01-foundations/arrays-and-vectors/example/main.js
17+
~~~
18+
19+
## Topics Covered
20+
21+
- Typed arrays such as number[] and string[].
22+
- Looping with for...of and array methods.
23+
- Filtering and mapping without losing readability.
24+
- Computing summary values from a list.
25+
26+
## Common Pitfalls
27+
28+
- Chaining too many array methods for a beginner example.
29+
- Forgetting that arrays are mutable by default.
30+
- Skipping empty-list checks before accessing index 0.
31+
32+
## Exercise Focus
33+
34+
- exercises/01.ts: read integers and print them in reverse order.
35+
- exercises/02.ts: remove duplicates while preserving the first appearance order.
36+
37+
### Exercise Specs
38+
39+
1. exercises/01.ts
40+
- Input: an integer N followed by N integers.
41+
- Output: the integers from last to first.
42+
- Edge cases: N <= 0 should print an error; repeated values should stay repeated in reverse.
43+
44+
2. exercises/02.ts
45+
- Input: one line of space-separated words.
46+
- Output: the unique words in first-seen order.
47+
- Edge cases: empty input should print an error; already unique input should stay unchanged.
48+
49+
## Checkpoint
50+
51+
- [ ] I can explain the main TypeScript idea in this module.
52+
- [ ] I can run the example and describe the output.
53+
- [ ] I completed exercises/01.ts.
54+
- [ ] I completed exercises/02.ts.

0 commit comments

Comments
 (0)