Search code examples
typescripttslint

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


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?


Solution

  • Turns out this can be done via:

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

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