enum A {
AA = 'AA',
BB = 'BB'
}
export interface OptionsA {a: number}
export interface OptionsB {b: string}
export interface ValuesA {a: boolean}
export interface ValuesB {b: boolean | null}
export interface FirstMapA {
[A.AA]: OptionsA,
[A.BB]: OptionsB
}
export interface SecondMapA {
[A.AA]: ValuesA,
[A.BB]: ValuesB
}
export class SomeThing<Type extends keyof FirstMapA> {
type: Type;
value: SecondMapA[Type];
doThings(): void {
if (this.type === A.AA) {
this.value.
}
}
}
While working on the "doThings" function in this code snippet, there is an issue where "this.value" is defined as ValuesA | ValuesB but it should only be ValuesA. Can you help identify the problem?