TypeScript const assertion: Avoid type widening inside function
I have the following object with a const assertion: const foo = { bar: [‘a’, ‘b’], } as const; My goal is to write a function that updates the bar array and correctly infers the new type. I can achieve the intended result when I pass foo.bar into the function: type Bar = Readonly<string[]>; function… Read More TypeScript const assertion: Avoid type widening inside function