ts报错Declaration of public instance field not allowed after declaration of public

1,162 阅读1分钟

描述:ts报错Declaration of public instance field not allowed after declaration of public instance method. Instead, this should come at the beginning of the class/interface.

原因分析:声明变量之前插入了函数

解决方案:将变量申明提到最前边

  • 错误写法 image.png
  • 正确写法

image.png