Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

missing return type on function @typescript-eslint/explicit-function-return-type

// If a function is dealing with multi returns with diffirent types 
//  then you are forced to specify the type.
// In adddition, if inside the function you have empty `return`s
//  then you must give them value for example `undefined`

// ES6 function. exmaple returning string or number:
const functionName = (): string | number => {
// ... code ...
}

// ES5 function. example returning string or number
function functionName(): string | number {
// ... code ...
}
 
PREVIOUS NEXT
Tagged: #missing #return #type #function
ADD COMMENT
Topic
Name
2+4 =