Currently, I am working on a function that requires specific typing:
const checkIfTagNeedsToBeCounted = (listOfTags: string[]): boolean => {
const tagsToExcludeFromCounting: string[] = [
"DoNotCount",
];
const excludedTagFound: boolean = listOfTags.some(
(singleTag) => tagsToExcludeFromCounting.includes(singleTag),
);
return !excludedTagFound;
};
However, when I try to define it with
const checkIfTagNeedsToBeCounted: Function = ...
I receive a warning from tslint:
Avoid using 'Function' as a type. It is recommended to use a specific function type, such as () => void
. (ban-types)
While I have been temporarily silencing this issue with
// tslint:disable-next-line: ban-types
const checkIfTagNeedsToBeCounted: Function = (listOfTags: string[]): boolean => {
I am curious to learn the correct way of typing a function according to tslint?