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?

More than 5 years have passed since last update.

JavaScriptで非推奨(deprecated)なものはFlowTypeでは存在しない(not found)のエラーになる

Last updated at Posted at 2017-07-18

概要

JavaScriptで非推奨(deprecated)なものはFlowTypeでは存在しない(not found)のエラーになる。
もしかしたらエラーになるものがあるが正しいかもしれませんが現状では判例としては1つだけです。
同じような事象が発生した場合のための調査の手がかりとして残します。

具体例

例えばDate.prototype.getYearが該当します。
https://msdn.microsoft.com/ja-jp/library/x0a9sc10(v=vs.94).aspx

次のようなエラーになります。

150:         && lhs.getYear() === rhs.getYear()
                    ^^^^^^^ property `getYear`. Property not found in
150:         && lhs.getYear() === rhs.getYear()
                ^^^ Date

解決策

上記のgetYearの解説ページには次のようにあります。

この方法は使用されなくで、下位互換性のみを目的として提供されます。 代わりに、getFullYear メソッドを使用してください。

なので、getYearの代わりにgetFullYear を使用するようにすればエラーにならなくなります。

その他

追加情報等あればコメント等いただけると助かります
優秀だけどもう少し気の利いたメッセージが欲しかった
※欲張りすぎ?

1
0
2

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?