I have a problem to solve, this problem is basically concat one value inside my array but the problem is my array won't accept a value i will concat inside the array below is my code.
interface SpecialtiesListProps { specialtyId: number; rqe: string;}const [id, setId] = useState<SpecialtiesListProps[]>([]);const [uf, setUf] = useState('');const handleChange = (value: string, SpecialtyId: number) => { const newIdFilter = id.find((item) => item.specialtyId === SpecialtyId); if (!newIdFilter) { setId([...id, {specialtyId: SpecialtyId, rqe: value}]); } else { setId( id.map((item) => { if (item.specialtyId === SpecialtyId) { return {specialtyId: Number(item.specialtyId), rqe: value}; } else { return item; } }), ); const newId = id.concat({uf}) setId(newId) } };
the error apear for me is this:
No overload matches this call.Overload 1 of 2, '(...items: ConcatArray[]): SpecialtiesListProps[]', gave the following error.Argument of type '{ uf: string; }' is not assignable to parameter of type 'ConcatArray'.Object literal may only specify known properties, and 'uf' does not exist in type 'ConcatArray'.Overload 2 of 2, '(...items: (SpecialtiesListProps | ConcatArray)[]): SpecialtiesListProps[]', gave the following error.Argument of type '{ uf: string; }' is not assignable to parameter of type 'SpecialtiesListProps | ConcatArray'.Object literal may only specify known properties, and 'uf' does not exist in type 'SpecialtiesListProps | ConcatArray'.ts(2769)
i don`t know how i solve that and i spent many hours try solve that.
bellow is a print of error to help