Skip to content

ref(ts): Convert formatters.jsx to TypeScript #14302

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

Merged
merged 2 commits into from
Aug 8, 2019
Merged

Conversation

lynnagara
Copy link
Member

Add the User type

@lynnagara lynnagara requested a review from a team August 7, 2019 01:12

export function userDisplayName(user) {
export function userDisplayName(user: User): string {
Copy link
Member

@markstory markstory Aug 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On line 7 this function uses get(user, 'name', ...) implying that email is an optional property. Should the type reflect that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Looking back at #13707, I see why this is the case now. I think I'll add a CommitAuthor type and type user as User | CommitAuthor so that we can keep the stricter typing for users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks for catching that!

Copy link
Member

@dashed dashed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@lynnagara lynnagara merged commit 9178705 into master Aug 8, 2019
@lynnagara lynnagara deleted the ts/formatters branch August 8, 2019 00:18
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants