コンパイラかく語りき

import { Fun } from 'programming'

2019-10-13から1日間の記事一覧

【TypeScript】The left -hand and right hand side of an arithmetic operation must be of type 'any', 'number' or an enum type の対処法

タイトルのようなエラーが出た時の対応方法。 自分の場合は、Date 型同士を比較しようとして、このエラーに遭遇しました。 指示通りに number 化することで解決。 const a = "1970/01/01" const b = "1970/01/02" // 誤) const result = new Date(a) - new …