Help me, please. I don't understand what's wrong.
I have a function that edits a form. I tried to set the param value of function "editCloneStateForm" type typeof this.form
but it doesn't work too. My code:
editCloneStateForm (value: string, key: IServiceDoneItemKeys) {
if (this.index >= 0) {
this.cloneStateForm[this.index].cdate = value
} else {
this.form[key] = value // Type 'string' is not assignable to type 'never'
}
}
form: IServiceDoneItem = {
id: 0,
cdate: '',
counterparty_id: '',
counterparty_name: '',
contract_id: '',
contract_number: '',
service_id: '',
statement_id: null,
service_count: 0,
cost: 0,
income: 0,
agents_commission: 0,
state_duty: 0,
ukap: ''
}
export interface IServiceDoneItem {
id?: number,
cdate: string,
counterparty_id: number | string,
counterparty_name: string,
contract_id: number | string,
contract_number: string,
service_id: number | string,
statement_id: number | null,
service_count: number,
cost: number,
income: number,
agents_commission: number,
state_duty: number,
ukap: string
}
export type IServiceDoneItemKeys = keyof IServiceDoneItem