Classes 9 exercises
Problem

Debugging the Builder Pattern

I've made a small alteration to this file based on the previous exercise's solution, and now the code is not working as expected:


class TypeSafeStringMap<TMap extends Record<string, string>> {
private map: TMap;
constructor() {
this.map = {} as TMap;
}
get(key: keyof TMap

Loading exercise

Transcript

0:00 I've made a small alteration to this file based on the previous exercise's solution. It's basically exactly the same, but I've made a small error and now it's not working anymore. Now we're getting map is record string string and record string.

0:19 We're not getting autocomplete inside Get anymore even though the set thing looks completely fine. Your job is to work out how I've broken this class here. It's only at the type level. I haven't changed much. In fact, it's only like three or four character's difference.

0:38 Good luck debugging this.