aahhuhuhu
aahhuhuhu

Reputation: 493

typescript warning Missing return type on function

I am using typrscript.
Missing return type on function.eslint@typescript-eslint/explicit-module-boundary-types) at (d:number).
How can I get rid of the warning?

const createDateTime = (d: number) => {
  const datetime = new Date(d * 1000);
  return datetime.toLocaleDateString();
};

Upvotes: 0

Views: 8782

Answers (1)

Elias Soares
Elias Soares

Reputation: 10254

Just define a return type to your function:

const createDateTime = (d: number): string => {
  const datetime = new Date(d * 1000);
  return datetime.toLocaleDateString();
};

Upvotes: 4

Related Questions