<?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: Ifeoluwa King</title>
    <description>The latest articles on DEV Community by Ifeoluwa King (@running_squirrel).</description>
    <link>https://dev.to/running_squirrel</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%2F2519384%2F5e4a9b9f-40a2-44c0-98f3-cef20f69118b.png</url>
      <title>DEV Community: Ifeoluwa King</title>
      <link>https://dev.to/running_squirrel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/running_squirrel"/>
    <language>en</language>
    <item>
      <title>Why Mobile Apps Deserve Their Own CMS</title>
      <dc:creator>Ifeoluwa King</dc:creator>
      <pubDate>Wed, 20 Aug 2025 04:16:50 +0000</pubDate>
      <link>https://dev.to/running_squirrel/why-mobile-apps-deserve-their-own-cms-311f</link>
      <guid>https://dev.to/running_squirrel/why-mobile-apps-deserve-their-own-cms-311f</guid>
      <description>&lt;p&gt;Every website has a CMS. WordPress, Shopify, Contentful — platforms that make content management simple and instant.&lt;br&gt;
But mobile apps? Still waiting days for app store approvals just to fix a typo.&lt;/p&gt;

&lt;p&gt;Why do apps lack the same content management flexibility as websites?&lt;br&gt;
Because app stores were built for static releases, not agile content updates.&lt;/p&gt;

&lt;p&gt;Product managers, marketers, and even compliance teams often need quick updates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Change a banner for a flash sale&lt;/li&gt;
&lt;li&gt; Update legal disclaimers&lt;/li&gt;
&lt;li&gt; Fix onboarding text&lt;/li&gt;
&lt;li&gt; Roll out seasonal content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these should require a rebuild.&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2F33j1wnnvilr0m4l0tuxq.png" class="article-body-image-wrapper"&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%2Farticles%2F33j1wnnvilr0m4l0tuxq.png" alt="Resyncbase Visual Editor" width="800" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ResyncBase is filling this gap: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built for React Native apps&lt;/li&gt;
&lt;li&gt;Instant content updates&lt;/li&gt;
&lt;li&gt;Live previews on iOS &amp;amp; Android&lt;/li&gt;
&lt;li&gt;Version history &amp;amp; rollback&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Benefit Beyond Speed? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Empower non-developers to make changes&lt;/li&gt;
&lt;li&gt;Reduce developer distraction&lt;/li&gt;
&lt;li&gt;Keep users happy with bug-free, up-to-date content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just as websites couldn’t scale without CMS platforms, mobile apps can’t stay competitive with app store delays.&lt;br&gt;
It’s time for a CMS for apps.&lt;/p&gt;

&lt;p&gt;Join the ResyncBase waitlist now at &lt;a href="http://www.resyncbase.com" rel="noopener noreferrer"&gt;www.resyncbase.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>saas</category>
      <category>reactnative</category>
      <category>product</category>
      <category>mobile</category>
    </item>
    <item>
      <title>How to Add a Vertical Timeline To your React Native App</title>
      <dc:creator>Ifeoluwa King</dc:creator>
      <pubDate>Fri, 07 Mar 2025 07:24:58 +0000</pubDate>
      <link>https://dev.to/running_squirrel/how-to-add-a-vertical-timeline-to-your-react-native-app-5afn</link>
      <guid>https://dev.to/running_squirrel/how-to-add-a-vertical-timeline-to-your-react-native-app-5afn</guid>
      <description>&lt;p&gt;To add a component to show the progress/timeline of a process with different statuses, you can use the library &lt;a href="https://www.npmjs.com/package/react-native-vertical-status-progress" rel="noopener noreferrer"&gt;react-native-vertical-status-progress&lt;/a&gt;. Works with Expo and React Native.&lt;/p&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2F4p0nw6dh8bu0y89sx88v.jpg" class="article-body-image-wrapper"&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%2Farticles%2F4p0nw6dh8bu0y89sx88v.jpg" alt="A Timeline of status progress" width="774" height="666"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The  component from the library is designed to visually represent the progress of a multi-step process. Each step is represented by a status indicator that can be customized to show whether the step is completed or pending. This component is ideal for workflows, onboarding processes, or any scenario where you need to display progress through a series of steps. It is compatible with both Expo and React Native projects, making it versatile and easy to integrate into your existing applications.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Accordion Support: Each status can be expanded or collapsed to show more details. This is useful for providing additional information or actions related to each step.
Customizable Content: You can render any component within the accordion, including call-to-action (CTA) buttons, forms, or any other React Native components.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install react-native-vertical-status-progress&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Usage&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;import { VerticalStatusProgress } from 'react-native-vertical-status-progress';

const statuses = [
  {
    title: 'Sign Up Complete',
    subtitle: 'You have successfully signed up.',
    status: 'registered',
  },
  {
    title: 'Set up your account',
    subtitle: 'Add your account details to get started.',
    renderContent: (
      &amp;lt;TouchableOpacity&amp;gt;
        &amp;lt;Text&amp;gt;vbireuvgbireubgireuf&amp;lt;/Text&amp;gt;
      &amp;lt;/TouchableOpacity&amp;gt;
    ),
    status: 'setting_up',
  },
  {
    title: 'Account Verification',
    subtitle: 'We are verifying your account.',
    renderContent: (
      &amp;lt;View&amp;gt;
        &amp;lt;Text&amp;gt;
          We will contact you shortly if we need any additional information.
          Please contact us if you have any questions. Check your email for
          updates.
        &amp;lt;/Text&amp;gt;
        &amp;lt;TouchableOpacity
          style={{
            backgroundColor: colors.ACCENT_BLUE,
            padding: 10,
            borderRadius: 5,
            width: 150,
            alignItems: 'center',
            marginTop: 10,
          }}
        &amp;gt;
          &amp;lt;Text style={{ color: '#fff' }}&amp;gt;Resend Email&amp;lt;/Text&amp;gt;
        &amp;lt;/TouchableOpacity&amp;gt;
      &amp;lt;/View&amp;gt;
    ),
    status: 'verifying',
  },
  {
    title: 'Account Verified',
    subtitle: 'Your account has been verified.',
    status: 'waiting',
  },
  {
    title: 'All Set!',
    subtitle:
      "You're all set up and ready to go. Start using your account now.",
    renderContent: (
      &amp;lt;View&amp;gt;
        &amp;lt;Text&amp;gt;
          Lorem ipsum dolor sit, amet consectetur adipisicing elit. A ullam
          assumenda obcaecati? Minima libero vitae ducimus, omnis, excepturi
          saepe, doloribus corrupti hic deleniti id iure? Qui consequuntur at
          magnam consequatur!
        &amp;lt;/Text&amp;gt;
      &amp;lt;/View&amp;gt;
    ),
    status: 'ready',
  },
];

const App = () =&amp;gt; {
    return (
        &amp;lt;VerticalStatusProgress statuses={statuses} /&amp;gt;
    );
};

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Customization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can customize the appearance of the react-native-vertical-status-progress component by passing in custom styles and render functions. Here are some examples:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Custom Ball Component&lt;/em&gt;&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;const renderCustomBall = (label, idx, isPrev, isFuture) =&amp;gt; (
  &amp;lt;View style={{ backgroundColor: isPrev ? 'blue' : 'grey', width: 16, height: 16, alignItems: 'center', justifyContent: 'center', borderRadius: 4 }}&amp;gt;
    &amp;lt;Text style={{ color: 'white', fontSize: 10 }}&amp;gt;{idx}&amp;lt;/Text&amp;gt;
  &amp;lt;/View&amp;gt;
);

&amp;lt;VerticalStatusProgress
  statuses={statuses}
  renderBall={renderCustomBall}
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Custom Stick Component&lt;/em&gt;&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;const renderCustomStick = (label, idx, isPrev, isFuture) =&amp;gt; (
  &amp;lt;View style={{ flex: 1, width: 5, backgroundColor: isPrev ? 'blue' : 'grey' }} /&amp;gt;
);

&amp;lt;VerticalStatusProgress
  statuses={statuses}
  renderStick={renderCustomStick}
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Custom Chevron Component&lt;/em&gt;&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;const renderCustomChevron = (open, index) =&amp;gt; (
  &amp;lt;Text&amp;gt;{open ? '-' : '+'}&amp;lt;/Text&amp;gt;
);

&amp;lt;VerticalStatusProgress
  statuses={statuses}
  renderChevron={renderCustomChevron}
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With react-native-vertical-status-progress it becomes very easy to add any timeline for status progress on your app.&lt;/p&gt;

&lt;p&gt;To see more details about customisation, props and example, visit the library page on npm or github.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>typescript</category>
      <category>expojs</category>
      <category>webcomponents</category>
    </item>
    <item>
      <title>How to Generate Types from Your Api Responses in Realtime in Typescript</title>
      <dc:creator>Ifeoluwa King</dc:creator>
      <pubDate>Wed, 04 Dec 2024 11:16:35 +0000</pubDate>
      <link>https://dev.to/running_squirrel/how-to-generate-types-from-your-api-responses-in-realtime-in-typescript-2m1i</link>
      <guid>https://dev.to/running_squirrel/how-to-generate-types-from-your-api-responses-in-realtime-in-typescript-2m1i</guid>
      <description>&lt;p&gt;I have always felt a bit annoyed whenever I’m working on a project and I have to add types to an api response.&lt;/p&gt;

&lt;p&gt;The process usually goes like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;write a function to fetch data&lt;/li&gt;
&lt;li&gt;call the function on a component or page&lt;/li&gt;
&lt;li&gt;either log the response or inspect the network tab to view the response
&lt;/li&gt;
&lt;li&gt;copy this response, create a new file and paste the response&lt;/li&gt;
&lt;li&gt;start editing the response to create a new type or interface&lt;/li&gt;
&lt;li&gt;import the new type to the function file and set it’s return type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This had been going on for a while and then I thought to find a way to automate it.&lt;/p&gt;

&lt;p&gt;This led to my discovery of a few libraries that can generate types. Unfortunately they were not convenient to work with because they were not generating the types effortlessly and in realtime. They required a lot of manual process as well. I wanted something I could just plug in and be done with and continue with my normal development flow.&lt;/p&gt;

&lt;p&gt;So I decided to build a library that will automate this process for me.&lt;/p&gt;

&lt;h2&gt;
  
  
  realtime-api-types
&lt;/h2&gt;

&lt;p&gt;&lt;a href="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%2Farticles%2Ft2k2x3ujtaxsdj3g9psv.png" class="article-body-image-wrapper"&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%2Farticles%2Ft2k2x3ujtaxsdj3g9psv.png" alt="Generation Service running" width="800" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The aim of this library is to take the pain away from trying to add types from your api responses.&lt;/p&gt;

&lt;p&gt;Find out more on: &lt;a href="https://www.npmjs.com/package/realtime-api-types" rel="noopener noreferrer"&gt;npm&lt;/a&gt; or &lt;a href="https://github.com/ifeoluwak/realtime-api-types" rel="noopener noreferrer"&gt;github&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;With this library, as you get responses from an api, it generates the type for you and saves it to your project, in real time.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It also imports the new type and sets it as the return type of your api call. How awesome is that!&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Just import the helper function and start the server. Thats all. You can then go on with your normal development flow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;This setup is meant only for development and not for production! You should not deploy this into your production pipeline.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This library was inspired by an old project I stumbled upon, called &lt;a href="https://github.com/jvilk/MakeTypes" rel="noopener noreferrer"&gt;MakeTypes&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;To get started, simply run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;realtime-api-types &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configuration
&lt;/h2&gt;

&lt;p&gt;There are some configs you need to set.  Go to your &lt;code&gt;package.json&lt;/code&gt; and add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"realtime-api-types"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"objectType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"typePath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"src/types"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"apiPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"src/apis"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"fetchType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"axios"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The shape of the config is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;objectType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;interface&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// whether you want to generate interfaces or types &lt;/span&gt;
  &lt;span class="nl"&gt;fetchType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fetch&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// how you fetch data, fetch or axios&lt;/span&gt;
  &lt;span class="nl"&gt;typePath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// the path to where you want to save generated types&lt;/span&gt;
  &lt;span class="nl"&gt;apiPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// the path to where your api methods exist&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Start Service
&lt;/h3&gt;

&lt;p&gt;To start the type generator service, run: &lt;code&gt;npx realtime-api-types --init&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Sample &amp;amp; Usage
&lt;/h2&gt;

&lt;p&gt;Wrap your apis in an object and wrap the object with &lt;code&gt;typedApiWrapper&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You should make your api methods pure, simply return the api call.&lt;/p&gt;

&lt;p&gt;You can use property assignments or methods or both.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please note that when you're done developing, remove &lt;code&gt;typedApiWrapper&lt;/code&gt; from this file completely.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Example &lt;/span&gt;

&lt;span class="c1"&gt;// src/apis/exercise.ts api file&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;typedApiWrapper&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;realtime-api-types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ExerciseApi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;typedApiWrapper&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="c1"&gt;// with fetch, property assignment style&lt;/span&gt;
  &lt;span class="na"&gt;getExercises&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://example-api.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="c1"&gt;// with axios, method style&lt;/span&gt;
   &lt;span class="nf"&gt;getExerciseById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://example-api.com/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;// api post method&lt;/span&gt;
  &lt;span class="nf"&gt;postExercise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://example-api.com`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;


&lt;span class="c1"&gt;// src/App.tsx file&lt;/span&gt;

&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;ExerciseApi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getExercises&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;With this setup, whenever an api is called at any point in time, the service will intercept and try to generate type from the response.&lt;/p&gt;

&lt;p&gt;When type generation is successful, the example file above would be automatically updated to something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// updated exercise.ts api file&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;typedApiWrapper&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;realtime-api-types&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;GetExercises&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/getExercises&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;GetExerciseById&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/getExerciseById&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PostExercise&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;../types/postExercise&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;ExerciseApi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;typedApiWrapper&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="c1"&gt;// with fetch, property assignment style&lt;/span&gt;
  &lt;span class="na"&gt;getExercises&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;GetExercises&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://example-api.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="c1"&gt;// with axios, method style&lt;/span&gt;
   &lt;span class="nf"&gt;getExerciseById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;GetExerciseById&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://example-api.com/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="c1"&gt;// api post method&lt;/span&gt;
  &lt;span class="nf"&gt;postExercise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PostExercise&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`https://example-api.com`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note the difference in structure of return type from fetch and axios.&lt;br&gt;
&lt;code&gt;axios&lt;/code&gt; returns a &lt;code&gt;data: Type&lt;/code&gt;. Do not mix axios and fetch in your project, else you'll get wrong types.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Naming Convention
&lt;/h2&gt;

&lt;p&gt;Note the naming convention in the example above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The name of the type file is the same as the name of the &lt;strong&gt;api method called&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The name of the type itself is the same as the name of the api method but in &lt;strong&gt;pascal case&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  React Native or Expo
&lt;/h2&gt;

&lt;p&gt;For this to work with React native or Expo, make sure you follow their guide on how to enable api calls to localhost&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cannot generate enums from response.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cannot extend type from different type files. If the response from a call contains object that is similar to another type in another file, it cannot extend it. A new type will be generated in the new file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cannot give custom file names or type names. File name and type name is solely based on the name of the api method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once a type has been generated for an api call, the type will not update with new api calls. You need to delete the previous generated type file to generate a new one.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;This library only serves to help you get started quickly and reduce time spent adding types to api calls. You might need to make some updates to the generated types sometimes. It does not solve all your type problems.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>api</category>
      <category>automation</category>
      <category>node</category>
    </item>
  </channel>
</rss>
