[TypeScript] The left-hand side of an arithmetic operation must be of type ‘any’ ‘number’ or an enum type (TS2363)
에러 해당 오류는 주로 타입스크립트에서 숫자가 아닌 것을 연산하는 과정에서 발생하게 됩니다. 자바스크립트 코드에서는 문제없지만 타입스크립트에선 에러를 표시합니다. for (let i = 0; i < contentsData.length - 1; i++) { beforeChartValue.push({ name: contentsData[i].menuName, value: Math.floor( contentsData[i].refStdKcal * contentsData[i].beforeAmount ), per: Math.floor( (contentsData[i].refStdKcal * contentsData[i].beforeAmount * 100) / RECOMMEND_KCAL_VALUE ), })위의 코드는 c..
Coding/TypeScript
2022. 5. 3. 23:47