Skip to content

Solution 2 for 08 unfinished? #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andy1li opened this issue Aug 25, 2022 · 1 comment
Closed

Solution 2 for 08 unfinished? #8

andy1li opened this issue Aug 25, 2022 · 1 comment

Comments

@andy1li
Copy link

andy1li commented Aug 25, 2022

Thank you, Matt, for your wonderful youtube videos!

Maybe I'm missing something, but it seems that solution no. 2 for exercise 08 does not "ensure that makeUser ALWAYS returns a User"(if the returned object was accidentally modified incorrectly)?

https://github.com/total-typescript/beginners-typescript/blob/f119964ad43dc2e5dfabd08e3aaf8f02c57981e9/src/08-function-return-type-annotations.solution.2.ts#L20-L33

@mattpocock
Copy link
Collaborator

Each problem/solution will be accompanied by a video. This is here for a reason, but it's hard to grok just from reading.

The reason it's here is to demonstrate that you can handle this just via inference - you can meet the user contract just through returning all the proper types.

McCambley added a commit to McCambley/beginners-typescript-tutorial that referenced this issue Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants