In frontend design systems, presentation components-small, focused components responsible solely for displaying data—are the building blocks of clean UI architecture. However, when these components accept raw arrays without strict contracts, optional fields like social links, profile URLs, and handles can easily lead to template errors or broken links.
In my recent contribution to GitLab's Contributors Platform ( MR !3194 ), I migrated the ContributorSocialLinks component and its test suite to strict TypeScript.
Here is a quick breakdown of how typing lightweight presentation components improves maintainability and test reliability.
1. The Challenge: Loose Array Props
Originally, ContributorSocialLinks.vue accepted contributors through standard runtime prop validation:
<!-- Before (JavaScript) --> <script setup > const props = defineProps ( { contributors : { type : Array , required : true , } , } ) ;
const contributorsWithSocials = props . contributors . filter ( contributor => contributor .…