-
Notifications
You must be signed in to change notification settings - Fork 1
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
Daniel user api #41
base: master
Are you sure you want to change the base?
Daniel user api #41
Conversation
…hen array is invalid
…ad of direct functions
name: string | ||
favoriteColor: string | ||
age: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all properties here should be readonly
export class UserAPI { | ||
|
||
constructor(private _users: Record<string, IUser> = {}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an exported Users
type would be beneficial here, since it is a domain shape that is used in many places. export type Users = Record<string, IUser>
} | ||
|
||
getUserById(id: string): Readonly<IUser> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getUserById(id: string): Readonly<IUser> { | |
getUserById(id: string): IUser { |
because IUser
is readonly (or will be once all of its properties are readonly
), we don't need Readonly
here.
there is a pattern you might see in some places where a declared interface extends an empty Readonly object, so that the properties don't have to be individually declared as readonly
. That pattern would also be acceptable
DO NOT MERGE
For review only.