クラスまたはインターフェースメンバの定義順が誤っています。 XXXX には「public static method」や「private instance fields」などが入ります。
エラーメッセージ例
-
[tslint] Declaration of public static method not allowed after declaration of public instance method. Instead, this should come after private instance fields. (member-ordering)
パブリック・インスタンス・メソッドの後にパブリック・スタティック・メソッドの宣言はできません。プライベートインスタンスフィールドの後に宣言するべきです。
-
[tslint] Declaration of public static method not allowed after declaration of public instance method. Instead, this should come at the beginning of the class/interface. (member-ordering)
パブリック・インスタンス・メソッドの後にパブリック・スタティック・メソッドの宣言はできません。クラス/インタフェースの始めに宣言するべきです。
解決方法
クラスまたはインターフェースメンバの順番を設定通りに並べ替えます。順番は tslint.json の "member-ordering" 設定で定義されています。「instance method」 と 「static method」 の見分け方
メソッド名の前に「static」キーワードが付いていれば「static method」、なければ「instance method」です。 一般的には static method -> instance method の順に記述します。// static method
static method1() {
}
// instance method
method1() {
}
検証環境
- typescript 2.6.2
- tslint 5.9.1
- Microsoft Windows 7 Professional Service Pack 1 (Microsoft Windows NT 6.1 (7601))