1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

「The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.」の解決方法

1
Posted at

はじめに

TypeScriptで開発中にエラーが発生した。

問題

エラー内容

The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.

元のコード

if (!title | title.trim()) {
      
}

解決方法

if (!title || title.trim()) {
      
}

パイプが一本足りませんでした。

おわりに

しょうもないミスですが、このエラーは初めて見ました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?