Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/TeamMember/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './index.css';

export interface Props {
withSponsor?: boolean;
githubName?: typeof withSponsor extends true ? string : never;
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this work anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image image

Yes, the githubName type will be undefined so it throws a type check error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have re-optimized the type definition to accommodate both cases where the "withSponsor" attribute is passed and when it is not. It should be much better now.

githubName?: string;
imgSrc: string;
children: any;
}
Expand Down Expand Up @@ -35,4 +35,4 @@ const { withSponsor, githubName, imgSrc } = Astro.props;
</a>
)}
</div>
</div>
</div>
5 changes: 4 additions & 1 deletion src/pages/team.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import TeamMemberName from '../components/TeamMemberName/index.astro';
<TeamMember
imgSrc="/andrea.png"
withSponsor
githubName="asturur"
>
<p>
<TeamMemberName name="Andrea Bogazzi" githubName="asturur" /> was born
Expand All @@ -30,6 +31,7 @@ import TeamMemberName from '../components/TeamMemberName/index.astro';
<TeamMember
imgSrc="/shachar.jpg"
withSponsor
githubName="ShaMan123"
>
<p>
<TeamMemberName name="Shachar Nencel" githubName="ShaMan123" /> is from
Expand All @@ -55,6 +57,7 @@ import TeamMemberName from '../components/TeamMemberName/index.astro';
<TeamMember
imgSrc="/steve-eberhardt.jpg"
withSponsor
githubName="melchiar"
>
<p>
<TeamMemberName name="Steve Eberhardt" githubName="melchiar" /> was born
Expand Down Expand Up @@ -129,4 +132,4 @@ import TeamMemberName from '../components/TeamMemberName/index.astro';
</p>
</TeamMember>
</main>
</Layout>
</Layout>