icfantv
icfantv

Reputation: 4643

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?

Upvotes: 41

Views: 15994

Answers (1)

icfantv
icfantv

Reputation: 4643

Turns out this can be done via:

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

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

Upvotes: 70

Related Questions