refactor(types): migrate client and server to TypeScript (#10) #23

Merged
Reliodas merged 1 commit from refactor/10-migrate-to-typescript into develop 2026-06-22 19:15:54 +00:00
Owner

Implémente le ticket #10 : migration complète vers TypeScript strict avec contrats partagés, sans changement de comportement.

Contrats partagés (shared/src, types only)

  • player, question, game-state (unions GameStatus/Round, GameState) et événements Socket.IO (ClientToServerEvents/ServerToClientEvents).
  • Importés via l'alias @shared/* en import type → s'effacent à la compilation, aucune dépendance runtime (verbatimModuleSyntax garantit l'effacement). Les 2 lockfiles restent séparés.

Serveur

  • Tous les src/*.js*.ts ; types internes Room/Player/GameState, serveur Socket.IO et projection d'état typés.
  • Outillage : tsconfig (NodeNext, strict), runner tsx (dev + tests node --import tsx --test, conserve node:test/mock timers), build tscdist.
  • question.service valide la banque au chargement (sans nouvelle dépendance, prépare #3).

Client

  • Tous les .js/.vue en TypeScript (lang=\"ts\"), defineProps/defineEmits typés via les contrats partagés, store useSocket et payloads d'action typés.
  • Outillage : tsconfig, vue-tsc (typecheck), vite.config.ts avec alias @shared.

CI / Docker

  • Steps de test Woodpecker exécutent aussi typecheck ; build-server passe en contexte racine pour voir shared/.
  • server/Dockerfile multi-stage (build tsc → runtime mince) ; .dockerignore et docker-compose adaptés.

Docs

  • docs/Implémentation.md et CONTRIBUTING.md documentent le setup TypeScript, les contrats partagés et les commandes typecheck.

Vérification

  • cd server && npm run typecheck && npm test && npm run build → typecheck OK, 70 tests (1 skip), node dist/app.js répond /health.
  • cd client && npm run typecheck && npm test && npm run build → typecheck OK, 33 tests, build OK.
  • Aucun any sur les contrats, aucun @ts-ignore.

Refs #10

Implémente le ticket #10 : migration complète vers TypeScript strict avec contrats partagés, sans changement de comportement. ## Contrats partagés (`shared/src`, types only) - `player`, `question`, `game-state` (unions `GameStatus`/`Round`, `GameState`) et événements Socket.IO (`ClientToServerEvents`/`ServerToClientEvents`). - Importés via l'alias `@shared/*` en `import type` → s'effacent à la compilation, aucune dépendance runtime (`verbatimModuleSyntax` garantit l'effacement). Les 2 lockfiles restent séparés. ## Serveur - Tous les `src/*.js` → `*.ts` ; types internes `Room`/`Player`/`GameState`, serveur Socket.IO et projection d'état typés. - Outillage : `tsconfig` (NodeNext, strict), runner `tsx` (dev + tests `node --import tsx --test`, conserve `node:test`/mock timers), build `tsc` → `dist`. - `question.service` valide la banque au chargement (sans nouvelle dépendance, prépare #3). ## Client - Tous les `.js`/`.vue` en TypeScript (`lang=\"ts\"`), `defineProps`/`defineEmits` typés via les contrats partagés, store `useSocket` et payloads d'action typés. - Outillage : `tsconfig`, `vue-tsc` (typecheck), `vite.config.ts` avec alias `@shared`. ## CI / Docker - Steps de test Woodpecker exécutent aussi `typecheck` ; `build-server` passe en contexte racine pour voir `shared/`. - `server/Dockerfile` multi-stage (build `tsc` → runtime mince) ; `.dockerignore` et `docker-compose` adaptés. ## Docs - `docs/Implémentation.md` et `CONTRIBUTING.md` documentent le setup TypeScript, les contrats partagés et les commandes `typecheck`. ## Vérification - `cd server && npm run typecheck && npm test && npm run build` → typecheck OK, 70 tests (1 skip), `node dist/app.js` répond `/health`. - `cd client && npm run typecheck && npm test && npm run build` → typecheck OK, 33 tests, build OK. - Aucun `any` sur les contrats, aucun `@ts-ignore`. Refs #10
Reliodas added this to the 1.0.0-alpha milestone 2026-06-22 19:14:45 +00:00
refactor(types): migrate client and server to TypeScript
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_metadata/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
0eb2cff06e
Introduce TypeScript (strict) across the project with shared contracts,
without changing runtime behaviour.

Shared contracts (shared/src, types only):
- player, question, game-state (GameStatus/Round unions, GameState) and
  Socket.IO events (ClientToServerEvents/ServerToClientEvents). Imported
  via the @shared/* alias as `import type`, so they erase at compile time
  and add no runtime dependency (verbatimModuleSyntax enforces this).

Server:
- all src/*.js -> *.ts, typed Room/Player/GameState internals, typed
  Socket.IO server/socket and broadcast projection.
- tooling: tsconfig (NodeNext, strict), tsx dev/test runner, tsc build to
  dist; scripts build/start/dev/typecheck/test updated.
- question.service validates the bundled bank at load (no new dependency).

Client:
- all .js/.vue -> TypeScript (lang="ts"), typed defineProps/defineEmits via
  shared types, typed useSocket store and emitted actions.
- tooling: tsconfig, vue-tsc typecheck, vite.config.ts with @shared alias.

CI / Docker:
- woodpecker test steps also run typecheck; build-server context moved to
  repo root so it can see shared/.
- server/Dockerfile is now multi-stage (build with tsc, slim runtime);
  .dockerignore and docker-compose updated accordingly.

Docs: Implémentation.md and CONTRIBUTING.md document the TypeScript setup,
shared contracts and typecheck commands.

Verification: server typecheck + 70 tests + build (node dist/app.js serves
/health); client typecheck + 33 tests + build; no `any` on contracts, no
@ts-ignore.

Refs #10

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reliodas merged commit 88ce942df8 into develop 2026-06-22 19:15:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: jeux/le-grand-concours#23
No description provided.