DEV Community

Discussion on: Advanced TypeScript Exercises - Question 2

Collapse
 
dwjohnston profile image
David Johnston

I think it fails because we always expect the output type to be equal to the generic type, although we always return a User.

Ah, of course.

Mark the output objects as T

I think this is a bad option, as it's possible that you would be now expecting an extra field to be there, that no longer exists.

Collapse
 
nombrekeff profile image
Keff

I think this is a bad option, as it's possible that you would be now expecting an extra field to be there, that no longer exists.

Agreed, this is why I marked the first option as preferred :P