should i use the typescript-eslintexplicit-function-return-type eslint rule?

I also believe that it is redundant. But only if you use --noImplicitAny. We all know that using any is a criminal offence in TypeScript, right? (Attempted joke)

So since TypeScript doesn’t allow implicit anys, everything is sensibly typed (unless you specify any explicitly, so add es-lint no-explicit-any to avoid prison time), TypeScript will make sure that all the function returns are properly typed and used accordingly.

And this way we gain more flexibility when having to change function signatures. Imaging changing id: number to id: string in all the project? So for more flexibilty you can also use id: Entity["id"] – longer to write but never breaks.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top