<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alaa Courdova</title>
    <description>The latest articles on DEV Community by Alaa Courdova (@alaa_courdova).</description>
    <link>https://dev.to/alaa_courdova</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F297268%2F5e4fe4e2-c067-493f-ae11-54edf6148d23.jpg</url>
      <title>DEV Community: Alaa Courdova</title>
      <link>https://dev.to/alaa_courdova</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alaa_courdova"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>Alaa Courdova</dc:creator>
      <pubDate>Thu, 05 Dec 2024 16:04:09 +0000</pubDate>
      <link>https://dev.to/alaa_courdova/-58hk</link>
      <guid>https://dev.to/alaa_courdova/-58hk</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/devteam" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__org__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F1%2Fd908a186-5651-4a5a-9f76-15200bc6801f.jpg" alt="The DEV Team" width="800" height="800"&gt;
      &lt;div class="ltag__link__user__pic"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3%2F13d3b32a-d381-4549-b95e-ec665768ce8f.png" alt="" width="500" height="500"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/devteam/join-us-for-the-next-frontend-challenge-december-edition-187c" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Join us for the next Frontend Challenge: December Edition!&lt;/h2&gt;
      &lt;h3&gt;dev.to staff for The DEV Team ・ Dec 4&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#devchallenge&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#frontendchallenge&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>easy way to memorize Shorthand Property for padding and margin</title>
      <dc:creator>Alaa Courdova</dc:creator>
      <pubDate>Sun, 05 Mar 2023 13:35:42 +0000</pubDate>
      <link>https://dev.to/alaa_courdova/easy-way-to-memorize-shorthand-property-for-padding-and-margin-2ljp</link>
      <guid>https://dev.to/alaa_courdova/easy-way-to-memorize-shorthand-property-for-padding-and-margin-2ljp</guid>
      <description>&lt;p&gt;you want to write the shorthand for the padding property but you can't memorize it ? &lt;/p&gt;

&lt;p&gt;I created a gif with hand gesture I use it each time to know the right order of the property&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tDKHLGYz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/chdudbl9g6lb6l1pyt15.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tDKHLGYz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/chdudbl9g6lb6l1pyt15.gif" alt="Image description" width="600" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;as you can see move your hand clockwise top right bottom left and that is the right order for the shorthand &lt;/p&gt;

&lt;p&gt;hope it helps &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Using Styles and StyleUrls Component Properties in Angular</title>
      <dc:creator>Alaa Courdova</dc:creator>
      <pubDate>Sun, 29 Jan 2023 16:35:49 +0000</pubDate>
      <link>https://dev.to/alaa_courdova/using-styles-and-styleurls-component-properties-in-angular-423c</link>
      <guid>https://dev.to/alaa_courdova/using-styles-and-styleurls-component-properties-in-angular-423c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Problem&lt;/strong&gt;&lt;br&gt;
repeating a style is common while coding , for example: - container , font-style buttons ..etc.&lt;/p&gt;

&lt;p&gt;As angular component is separated (CSS and HTML) , We face a repetitive code and if we need to change a style we needs to change many time for minor change -maybe-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✨Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;styleUrls: ['./component1.scss',&lt;br&gt;
    '../component2.scss']&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@Component({
  selector: 'component',
  templateUrl: './component.html',

  styleUrls: ['./component1.scss',
    '../component2.scss']
})

export class Component implements OnInit {
  ngOnInit(): void {
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so if the style we need is existing in a different component we can add the path of CSS , better than copying the style code&lt;/p&gt;

</description>
      <category>welcome</category>
    </item>
    <item>
      <title>what to do when you can't typedef 'any' .. ?</title>
      <dc:creator>Alaa Courdova</dc:creator>
      <pubDate>Mon, 21 Nov 2022 10:18:41 +0000</pubDate>
      <link>https://dev.to/alaa_courdova/what-to-do-when-you-cant-typedef-any--1l55</link>
      <guid>https://dev.to/alaa_courdova/what-to-do-when-you-cant-typedef-any--1l55</guid>
      <description>&lt;p&gt;It's best practices to not let your code with no type : &lt;/p&gt;

&lt;p&gt;&lt;code&gt;let address;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;let name;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;this code above doesn't say much about how the &lt;code&gt;address&lt;/code&gt; will be presented ! &lt;/p&gt;

&lt;p&gt;will it be one line:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"address": "22 Rue du Grenier Saint-Lazare\n75003 Paris\nFrance"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;or&lt;/p&gt;

&lt;p&gt;series of structured attributes :&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "address": {
    "street": "22 Rue du Grenier Saint-Lazare",
    "postalCode": "75003",
    "city": "Paris",
    "countryCode": "FRA",
    "country": "France",
    "text": "22 Rue du Grenier Saint-Lazare\n75003 Paris\nFrance"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;that's why it is important to add type to your code , but on other hand 'any' is a type too ?? &lt;/p&gt;

&lt;p&gt;&lt;em&gt;is it ok ?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;No!.. as 'any' type on typescript is not doing us any favor it also doesn't provide much knowledge about the structure that we sending to a function ... unit test ... API call .. etc.&lt;/p&gt;

&lt;p&gt;so to prevent this happening, I add a tslint rule on the project file &lt;em&gt;tslint.json&lt;/em&gt;:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
"no-any": [true, {"ignore-rest-args": true}],&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;this rule alarm developer to 'any' type used it is very cool ..&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;u&gt;Note&lt;/u&gt;&lt;br&gt;
If "ignore-rest-args": true is provided rest arguments will be ignored.&lt;br&gt;
this rule will effect the all file , so if you touched an old file while adding this lint rule you need to add types to all variables with 'any' type&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Passes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let foo: object;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Fails&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let foo: any;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;for more details : &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://palantir.github.io/tslint/rules/no-any/" rel="noopener noreferrer"&gt;
      palantir.github.io
    &lt;/a&gt;
&lt;/div&gt;



&lt;p&gt;I came cross challenging situations when a function takes an attribute , but due to 'any' type or no-type at all the attribute was once &lt;em&gt;string&lt;/em&gt; the other call &lt;em&gt;number&lt;/em&gt;  !! it is confusing &lt;/p&gt;

&lt;p&gt;so what to do Now !!&lt;/p&gt;

&lt;p&gt;I found that we can use &lt;strong&gt;'union type'&lt;/strong&gt;  it is like you can add both types to a single variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;value: string | number;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;that's do the trick ! and you can add as much type as you want using '|' pipe sign. &lt;/p&gt;

&lt;p&gt;I am not sure if it is a good practice , but don't over use it :D &lt;/p&gt;

&lt;p&gt;Hope it was useful. &lt;/p&gt;

</description>
      <category>typescript</category>
      <category>any</category>
      <category>tslint</category>
    </item>
  </channel>
</rss>
