Thanks again for taking the time to share this. Would you mind explaining to me the difference between these two functions? The seem to do the same thing.
Those two functions do exactly the same, the return type annotation in the second case is redundant since the type is inferred by the compiler, but might make it more clear for those who are going to read the code (however, unlikely 😉). I would say the type annotation is unnecessary.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Greeting Ms. Krutikova,
Thanks again for taking the time to share this. Would you mind explaining to me the difference between these two functions? The seem to do the same thing.
Posting screenshot for the annotations. Looks like the second one makes sure that the type returned is
t('data)
for some reason. Is that right?Can't get devto to load the screenshot so here is the link they provided.
thepracticaldev.s3.amazonaws.com/i...
Tack!
Thank you for your feedback!
Those two functions do exactly the same, the return type annotation in the second case is redundant since the type is inferred by the compiler, but might make it more clear for those who are going to read the code (however, unlikely 😉). I would say the type annotation is unnecessary.