From ba40febb071f86879433206ece662127f2e4a6fb Mon Sep 17 00:00:00 2001 From: Arno Chauveau Date: Thu, 24 Jul 2025 09:53:13 +0200 Subject: [PATCH] Add some comments to code that can't be changed because of requirements --- TypeScript/app/gilded-rose.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/TypeScript/app/gilded-rose.ts b/TypeScript/app/gilded-rose.ts index db58d678..b1725f20 100644 --- a/TypeScript/app/gilded-rose.ts +++ b/TypeScript/app/gilded-rose.ts @@ -3,6 +3,13 @@ export class Item { sellIn: number; quality: number; + // can't edit this constructor because of the kata rules. + // but I would change the constructor to take a javaScript object. + // It makes the consumer code more readable. + // e.g. new Item({ name: "standard item", sellIn: 0, quality: 2 }) + // instead of new Item("standard item", 0, 2) + + // I would also type the parameters, because now they are implicitly any. constructor(name, sellIn, quality) { this.name = name; this.sellIn = sellIn; @@ -11,6 +18,8 @@ export class Item { } export class GildedRose { + // also can't edit this because of the kata rules. + // But I prefer typing this as : Item[] items: Array; constructor(items = [] as Array) {