Do you have any suggestions on how to specify to TypeScript that I am passing the same required argument? Currently, I am encountering an error stating (is not assignable to parameter of type '{ [key: string]: ""; } ). If you could provide guidance on how to declare types in this scenario, it would be greatly appreciated.
const initialState = { name: '', gender: '', height: '', weight: '' };
const [selected, setSelected] = useState<{ [key: string]: '' }>(initialState);
I attempted a solution, but it appears to involve redundant code
type state = { [key: string]: '' };
const initialState: state = { name: '', gender: '', measurements: '', height: '', weight: '' };
const [selected, setSelected] = useState<state>(initialState);