我正在尝试将对象用作我的应用状态的入口点,但似乎TS阻止了我执行doig操作,因此标题出现throwinand错误。
这是对象:
const registerFormBasicState = {
location: {
locationExtraDetails: {
regon: 0,
name: "",
nip: "",
krs: "",
address: "",
postalCode: "",
postalCity: "",
city: "",
district: "",
phoneNumber: "",
internalNumber: "",
homePage: "",
companyEmail: "",
companyProfile: [{id:"", value:""}],
agreeToSellingEmails: false,
agreeToSellingPhones: false,
agreeToMarketingEmails: false,
agreeToMarketingPhones: false,
agreeToSharingData: false
}
}
};
这是我为保存数据的组件创建的接口:
export interface data {
location: {
fullName: string;
locationExtraDetails: {
regon: number;
name: string;
nip: string;
krs: string;
address: string;
postalCode: string;
postalCity: string;
city: string;
district: string;
phoneNumber: string;
internalNumber: string;
homePage: string;
companyEmail: string;
options: any;
agreeToSellingEmails: boolean;
agreeToSellingPhones: boolean;
agreeToMarketingEmails: boolean;
agreeToMarketingPhones: boolean;
agreeToSharingData: boolean;
}
}
};
完整错误:
Object literal may only specify known properties, and 'registerFormState' does not exist in type 'stateManagementProps'.ts(2322)```