Is there a way to enforce method return types on Typescript classes via a tslint rule?

老子叫甜甜 提交于 2019-11-29 16:29:54

问题


I've read the tslint rules here and while it looks like the typedef rule's call-signature option is what I want, it doesn't complain about the lack of a return type.

Anyone know the rule (f one exists) to enforce return types on class methods?


回答1:


Turns out this can be done via:

"typedef": [
  true,
  "call-signature",
  "property-declaration"
]

More info: https://palantir.github.io/tslint/rules/typedef/



来源:https://stackoverflow.com/questions/42793701/is-there-a-way-to-enforce-method-return-types-on-typescript-classes-via-a-tslint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!