I have this union type:
export interface IUserInfosLogin {
usernameOrEmail: string;
password: string;
}
export interface IUserInfosRegister {
username: string;
email: string;
password: string;
passwordConfirm: string;
}
export type TUserInfos = IUserInfosLogin | IUserInfosRegister;
And I would like a const [userInfos, setUserInfos] = useState<TUserInfos>{} to take just one of these types, but when I try to access userInfos only password is available.
Can someone explain it to me?