Reputation: 493
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
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