initial commit

This commit is contained in:
2026-01-17 08:33:44 +01:00
commit 7920e8c4e5
9 changed files with 251 additions and 0 deletions

15
exercice2.ts Normal file
View File

@@ -0,0 +1,15 @@
interface Utilisateur {
nom: string;
age: number;
}
function afficherUtilisateur(u: Utilisateur): void {
console.log(`${u.nom} a ${u.age} ans`);
}
afficherUtilisateur({ nom: "Alice", age: 25 });
// L'argument de type '{ nom: string; }' n'est pas attribuable
// au paramètre de type 'Utilisateur'.
// La propriété 'age' est absente du type '{ nom: string; }'
// mais obligatoire dans le type 'Utilisateur'.ts(2345)
afficherUtilisateur({ nom: "Bob" });