LES 4 HUISWERK: JAVASCRIPT TO TYPESCRIPT CONVERTER
====================================================

Project Location: /sessions/wonderful-dazzling-hamilton/les4-huiswerk/

PROJECT STRUCTURE
=================

/les4-huiswerk/
├── src/                          (Source code - JavaScript to convert)
│   ├── users.js                  (User management functions)
│   ├── products.js               (Product management functions)
│   ├── orders.js                 (Order management functions)
│   └── utils.js                  (Utility functions)
├── __tests__/                    (Test files - Already in TypeScript!)
│   ├── users.test.ts             (5 tests for User module)
│   ├── products.test.ts          (7 tests for Products module)
│   ├── orders.test.ts            (6 tests for Orders module)
│   └── utils.test.ts             (6 tests for Utils module)
├── package.json                  (Node project configuration)
├── tsconfig.json                 (TypeScript strict configuration)
├── jest.config.js                (Jest test runner configuration)
└── README.md                      (Instructions in Dutch)

FILES CREATED: 12
================

CONFIGURATION FILES (3)
- package.json: Scripts: npm run check, npm test, npm run build
- tsconfig.json: Strict mode enabled, allowJs: true for gradual conversion
- jest.config.js: ts-jest preset for TypeScript testing

SOURCE CODE FILES (4 JavaScript files to convert)
- src/users.js (5 functions, ~20 lines)
- src/products.js (6 functions, ~45 lines)
- src/orders.js (5 functions, ~35 lines)
- src/utils.js (5 functions, ~40 lines)
Total: ~21 functions to convert

TEST FILES (4 TypeScript files with type examples)
- __tests__/users.test.ts (5 tests, shows User interface)
- __tests__/products.test.ts (7 tests, shows Product interface)
- __tests__/orders.test.ts (6 tests, shows Order interface)
- __tests__/utils.test.ts (6 tests, shows expected types)
Total: 24 tests

DOCUMENTATION
- README.md: Full instructions in Dutch with:
  - Project overview
  - Installation steps
  - Step-by-step conversion guide
  - Type hints explanation
  - Common issues and solutions
  - Tips and examples

STUDENT WORKFLOW
================
1. Run: npm install
2. For each JavaScript file (users.js → products.js → orders.js → utils.js):
   a. Rename: users.js → users.ts
   b. Add interfaces from test files
   c. Add type annotations to all functions
   d. Run: npm run check
   e. Run: npm test
3. Final verification:
   - npm run check (must pass - no errors)
   - npm test (all 24 tests must pass)

KEY FEATURES
============
✓ Gradual conversion (allowJs: true in tsconfig)
✓ Tests show expected types/interfaces
✓ Real-world modules (users, products, orders, utils)
✓ Proper error handling in source code
✓ Complex types: unions, arrays, interfaces
✓ Dutch language documentation (for non-English cohorts)
✓ Strict TypeScript config teaches best practices
✓ All JavaScript code is working and tested

WHAT STUDENTS LEARN
===================
- Basic TypeScript syntax and types
- Interfaces for object types
- Function parameter and return type annotations
- Union types (string | number, Type | null)
- Optional properties (key?: Type)
- Array types (Type[])
- Working with existing tests to understand types
- Verification with npm run check
- Testing with Jest

NOTES
=====
- All 4 JavaScript source files are fully working
- Tests use type assertions (as Type) to work with untyped JS imports
- Once converted to TS, tests will work with proper types
- README.md includes troubleshooting section
- Optional exercises for advanced students after conversion
