Comparing the values of x1, y1 and z1 in PointDto
objects (point1 and point2)
Example :-
point1 => PointDto:
{
x1: "1.000000",
y1: "1.0",
z1: undefined
pointIndex: 0,
}
point2 => PointDto:
{
x1: 1,
y1: 1,
z1: undefined
pointIndex: 1,
}
const keys: any = {
"x1": "x1",
"y1": "y1",
"z1": "z1"
}
const isEqual = (point1: PointDto, point2: PointDto) => {
return keys.every((key :string) => (isNaN(point1[key]) ? point1[key] : +point1[key]) === point2[key]);
}
Encountered a typescript error while writing (point1[key]), any suggestions on how to address this issue?
'Element implicitly has an 'any' type because expression of type 'string' can't be used to index type PointDto
.
No index signature with a parameter of type 'string' was found on type PointDto.ts(7053)