<?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>Forem: SAIFUL ISLAM (Fahim)</title>
    <description>The latest articles on Forem by SAIFUL ISLAM (Fahim) (@siffahim).</description>
    <link>https://forem.com/siffahim</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%2F821298%2F3499d919-2199-4009-bc71-1a5585cd5075.png</url>
      <title>Forem: SAIFUL ISLAM (Fahim)</title>
      <link>https://forem.com/siffahim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/siffahim"/>
    <language>en</language>
    <item>
      <title>Limitation of the TypeScript type system</title>
      <dc:creator>SAIFUL ISLAM (Fahim)</dc:creator>
      <pubDate>Tue, 30 May 2023 13:23:05 +0000</pubDate>
      <link>https://forem.com/siffahim/limitation-of-the-typescript-type-system-3m5n</link>
      <guid>https://forem.com/siffahim/limitation-of-the-typescript-type-system-3m5n</guid>
      <description>&lt;p&gt;In TypeScript, when you use a type alias with a return type of void for a function, it does not enforce that the function actually returns void. This is a limitation of the TypeScript type system.&lt;/p&gt;

&lt;p&gt;Type aliases in TypeScript are used to create reusable type definitions, but they do not provide strict runtime enforcement. When you define a type alias with a return type of void, it serves as a hint or documentation for the expected return type of the function. However, TypeScript does not enforce that the function adheres to that return type.&lt;/p&gt;

&lt;p&gt;Here's an example to illustrate this behavior:&lt;/p&gt;

&lt;p&gt;typescript Copy code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type MyFunctionType = () =&amp;gt; void;

const myFunction: MyFunctionType = () =&amp;gt; {
  return "This doesn't match the expected return type";
};

console.log(myFunction()); // Output: "This doesn't match the expected return type"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, we define a type alias MyFunctionType for a function with a return type of void. However, the implementation of myFunction actually returns a string, which doesn't match the expected return type. TypeScript doesn't raise any error for this mismatch.&lt;/p&gt;

&lt;p&gt;It's important to note that type aliases are purely a compile-time construct in TypeScript. They provide improved readability and maintainability by giving names to complex or reusable types, but they don't introduce runtime checks or strict enforcement of the defined types.&lt;/p&gt;

&lt;p&gt;If you need strict enforcement of return types, you can use TypeScript's built-in function syntax to specify the return type directly in the function signature, like this:&lt;/p&gt;

&lt;p&gt;typescript Copy code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function myFunction(): void {
  return "This will cause a compile-time error";
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this approach, TypeScript will correctly raise an error because the function is declared to have a return type of void, but it's actually returning a string.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>type</category>
      <category>wrong</category>
    </item>
    <item>
      <title>Test</title>
      <dc:creator>SAIFUL ISLAM (Fahim)</dc:creator>
      <pubDate>Thu, 12 Jan 2023 16:34:23 +0000</pubDate>
      <link>https://forem.com/siffahim/test-47f4</link>
      <guid>https://forem.com/siffahim/test-47f4</guid>
      <description>&lt;p&gt;Welcome To DEv&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>gamechallenge</category>
      <category>discuss</category>
      <category>ai</category>
    </item>
    <item>
      <title>Started with Redux Toolkit</title>
      <dc:creator>SAIFUL ISLAM (Fahim)</dc:creator>
      <pubDate>Thu, 24 Feb 2022 17:12:22 +0000</pubDate>
      <link>https://forem.com/siffahim/started-with-redux-toolkit-4ok4</link>
      <guid>https://forem.com/siffahim/started-with-redux-toolkit-4ok4</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Redux?&lt;/strong&gt;&lt;br&gt;
Redux is an open-source JavaScript library for managing and centralising application state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is it more preferred?&lt;/strong&gt;&lt;br&gt;
While working as a Front-end Developer or Full Stack Developer, many engineers encountered Redux. But Recently Redux Team launched Redux Toolkit, an officially recommended and a SOPE library that stands for Simple, Opinionated, Powerful, and Effective state management library. It allows us to write more efficient code, speed up the development process, and automatically apply the best-recommended practices. It was mainly created to solve the THREE MAJOR ISSUES with Redux:&lt;/p&gt;

&lt;p&gt;Configuring a Redux store is too complicated&lt;br&gt;
Have to add a lot of packages to build a large scale application&lt;br&gt;
Redux requires too much boilerplate code which makes it cumbersome to write efficient and clean code.&lt;br&gt;
It also provides the automatic support for Redux Dev-tools Extension and for immer.js library which is a great tool to deal with immutable objects. You can also use the various predefined functions of Redux Toolkit which not only speeds up the process but also saves time.&lt;/p&gt;

&lt;p&gt;Dependencies that comes along with Redux Toolkit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;immer&lt;/li&gt;
&lt;li&gt;redux&lt;/li&gt;
&lt;li&gt;redux-thunk&lt;/li&gt;
&lt;li&gt;reselect&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Purpose&lt;/strong&gt;​&lt;br&gt;
The Redux Toolkit package is intended to be the standard way to write Redux logic. It was originally created to help address three common concerns about Redux:&lt;/p&gt;

&lt;p&gt;"Configuring a Redux store is too complicated"&lt;br&gt;
"I have to add a lot of packages to get Redux to do anything useful"&lt;br&gt;
"Redux requires too much boilerplate code"&lt;br&gt;
We can't solve every use case, but in the spirit of create-react-app and apollo-boost, we can try to provide some tools that abstract over the setup process and handle the most common use cases, as well as include some useful utilities that will let the user simplify their application code.&lt;/p&gt;

&lt;p&gt;Redux Toolkit also includes a powerful data fetching and caching capability that we've dubbed "RTK Query". It's included in the package as a separate set of entry points. It's optional, but can eliminate the need to hand-write data fetching logic yourself.&lt;/p&gt;

&lt;p&gt;These tools should be beneficial to all Redux users. Whether you're a brand new Redux user setting up your first project, or an experienced user who wants to simplify an existing application, Redux Toolkit can help you make your Redux code better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;​&lt;br&gt;
Using Create React App​&lt;br&gt;
The recommended way to start new apps with React and Redux is by using the official Redux+JS template or Redux+TS template for Create React App, which takes advantage of Redux Toolkit and React Redux's integration with React components.&lt;/p&gt;

&lt;h1&gt;
  
  
  Redux
&lt;/h1&gt;

&lt;p&gt;npm install redux&lt;/p&gt;

&lt;h1&gt;
  
  
  Redux + Plain JS template:
&lt;/h1&gt;

&lt;p&gt;npx create-react-app my-app --template redux&lt;/p&gt;

&lt;h1&gt;
  
  
  Redux + TypeScript template:
&lt;/h1&gt;

&lt;p&gt;npx create-react-app my-app --template redux-typescript&lt;/p&gt;

&lt;p&gt;You can also go to the redux documentation page for more knowledge. Here redux inform link: &lt;a href="https://redux-toolkit.js.org/introduction/getting-started" rel="noopener noreferrer"&gt;https://redux-toolkit.js.org/introduction/getting-started&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  collected from redux toolkit
&lt;/h1&gt;

</description>
      <category>react</category>
      <category>redux</category>
    </item>
  </channel>
</rss>
