I want to disable the ability to use \"any\" in typescript. For example, I have the following function
func() {
return true
}
i want to requ
No, Function return types are inferred in typescript. The compiler itself has no setting to turn off type inference on functions. This feature was requested and decline as discussed in this issue filed on the typescript repository.
However, your favourite lint tool can warn you when there is no type definition specified for a function. For completeness, I will provide this information.
tslint
The rule is called typedef. Add the following line to your tslint config
"typedef": [ true, "call-signature", "arrow-call-signature" ]
eslint
The typescript-eslint plugin has this rule called explicit-function-return-type. (I cannot provide configuration instructions as I do not use eslint. Anyone is welcome to edit it in)