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?

久々にJavaScript書いたら型定義で怒られた

1
Posted at

手グセで new Map<string, number>() と書いたらエディタに SyntaxError: Missing initializer in const declaration と怒られました。
ファイル拡張子が .ts ではなく .js だったからです。
そういえばJavaScriptでは型定義ができないんでした。なんか書いてて気持ち悪かったです。

結論

一応JSDocを使えば回避策はあるらしいですが面倒なのでTypeScriptを使いたいと思います。

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?