I am looking for a rule that prevents usage of "Function" as a type
myMethod: Function;
I didn't find anything so I am open to suggestions :)
I am looking for a rule that prevents usage of "Function" as a type
myMethod: Function;
I didn't find anything so I am open to suggestions :)
You can use the @typescript-eslint/ban-types rule Rule Link. But this will also ban the other default types too like String, Boolean, etc. Link of other default banned types
If you wish to only ban Function and disable the other bans then add this to your .eslintrc file.
"@typescript-eslint/ban-types": ["error",
{
"types": {
"String": false,
"Boolean": false,
"Number": false,
"Symbol": false,
"{}": false,
"Object": false,
"object": false,
"Function": true,
},
"extendDefaults": true
}
]
You can use eslint, following rule bans Function type