class Dictionary<T> { private items: { [key: string]: T }; constructor() { this.items = {}; } // Method to check if the dictionary contains a key has(key: string): boolean { return key in this.items; } // Method to add or update a key-value pair set(key: string, value: T): void { this.items[key] = value; } // Method to get the value associated with a key get(key: string): T | undefined { return this.items[key]; } // Method to remove a key-value pair delete(key: string): void { if (this.has(key)) { delete this.items[key]; } } // Method to get all keys keys(): string[] { return Object.keys(this.items); } // Method to get all values values(): T[] { return Object.values(this.items); } // Method to get all key-value pairs entries(): [string, T][] { return Object.entries(this.items); } // Method to clear the dictionary clear(): void { this.items = {}; } // Method to get the size of the dictionary size(): number { return Object.keys(this.items).length; } // Custom getter for [key] syntax get [key: string](): T | undefined { return this.items[key]; } // Custom setter for [key] syntax set [key: string](value: T) { this.items[key] = value; } } // Test the modified Dictionary class const dict = new Dictionary<number>(); dict.set("a", 1); dict.set("b", 2); dict.set("c", 3); console.log(dict.get("a")); // Output: 1 console.log(dict.keys()); // Output: ["a", "b", "c"] console.log(dict.values()); // Output: [1, 2, 3] dict.delete("b"); console.log(dict.keys()); // Output: ["a", "c"] dict.clear(); console.log(dict.size()); // Output: 0 // Using [key] syntax dict["x"] = 10; console.log(dict["x"]); // Output: 10 console.log(dict["d"]); // Output: undefinedconst dict: { [key: keyType]: valueType};var persons: { [id: string] : string; } = {}; persons["p1"] = { firstName: "F1", lastName: "L1" };obj: { [key: string]: string }