typescript missing return type on function

Solutions on MaxInterview for typescript missing return type on function by the best coders in the world

showing results for - "typescript missing return type on function"
Kamelia
09 Aug 2017
1//                    param type    return type
2function myFunction(params: string): number {
3  // do some with params (type string)
4  // Return a number
5}
6// Leaving return type out may cause below error:
7// Missing return type on function.eslint(@typescript-eslint/explicit-function-return-type)
8
9// Example with React
10import React from "react"; // or import React, { FC } from "react";
11const Component: React.FC<MyPropType> = (props: MyPropType) => {
12  return <p>Hello, React</p>;
13}