<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ilyès Hernandez  on Medium]]></title>
        <description><![CDATA[Stories by Ilyès Hernandez  on Medium]]></description>
        <link>https://medium.com/@ilyeshernandez.apple?source=rss-af583f80ad1f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Ilyès Hernandez  on Medium</title>
            <link>https://medium.com/@ilyeshernandez.apple?source=rss-af583f80ad1f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 19:48:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ilyeshernandez.apple/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Understanding the “Pick” Type in TypeScript]]></title>
            <link>https://medium.com/@ilyeshernandez.apple/understanding-the-pick-type-in-typescript-80cf2463454c?source=rss-af583f80ad1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/80cf2463454c</guid>
            <category><![CDATA[picks]]></category>
            <category><![CDATA[utility-types]]></category>
            <category><![CDATA[t]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[toolbox]]></category>
            <dc:creator><![CDATA[Ilyès Hernandez ]]></dc:creator>
            <pubDate>Mon, 25 Dec 2023 13:16:54 GMT</pubDate>
            <atom:updated>2023-12-25T13:16:54.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r9Ype83TFl1N-6f0KPzNdg.png" /></figure><h3><strong>Introduction</strong></h3><p>TypeScript, as a statically-typed superset of JavaScript, provides various powerful features to help developers write more robust and secure code. One of these interesting types is the “Pick” type. In this article, we will explore what the “Pick” type is, why it’s useful, and how to use it in your TypeScript projects.</p><h3>What is the “Pick” Type?</h3><p>The “Pick” type is a TypeScript feature that allows you to create a new type by extracting certain properties from an existing type. This can be particularly useful when you have a complex type with many properties, but you only need a specific subset of those properties in certain parts of your code.</p><h3>Basic Syntax</h3><p>The basic syntax for the “Pick” type is as follows:</p><pre>type NewType = Pick&lt;ExistingType, &#39;Property1&#39; | &#39;Property2&#39; | …&gt;;</pre><p>This creates a new type that contains only the specified properties from ExistingType.</p><h3>Concrete Example</h3><p>Let’s consider a concrete example to better understand the usage of the “Pick” type. Suppose we have a Person type with several properties:</p><pre>type Person = {<br>  name: string;<br>  age: number;<br>  address: string;<br>  email: string;<br>};</pre><p>If we want to create a new type that only contains the name and age properties, we can use the &quot;Pick&quot; type as follows:</p><pre>type BasicProfile = Pick&lt;Person, &#39;name&#39; | &#39;age&#39;&gt;;</pre><p>Now, the BasicProfile type will only contain the name and age properties from Person.</p><h3>Advantages of Using the “Pick” Type</h3><p>Using the “Pick” type has several advantages:</p><ol><li><strong>Reduced Complexity:</strong> By creating subtypes that contain only the necessary properties, the code becomes more readable and easier to understand.</li><li><strong>Code Reusability:</strong> By defining specific subtypes, you can reuse them in different parts of your application without having to specify all properties again.</li></ol><h3>Conclusion</h3><p>In conclusion, the “Pick” type is a powerful tool in the toolkit of any TypeScript developer. By selectively extracting properties from an existing type, you can make your code more readable, safer, and easier to maintain. Feel free to integrate the “Pick” type into your TypeScript toolbox to enhance the quality of your code.</p><p>Don’t forget to check <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html">the official TypeScript documentation</a> on the “Pick” type for more information and examples.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80cf2463454c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>