i have this function that randomize 3 strings, but when i try to return the value, i got this error
Type 'string' is not assignable to type '"DAY" | "GTD" | "GTC"'
my function:
export const randomizeTimeinforce = (): 'DAY' | 'GTD' | 'GTC' => {
const timeinforce = ['DAY', 'GTD', 'GTC'];
return timeinforce[Math.floor(Math.random() * 3)];
};
export class MyCoolClass {
public timeinforce: 'DAY' | 'GTD' | 'GTC' = randomizeTimeinforce();
}