Chris Padilla/Blog

My passion project! Posts spanning music, art, software, books, and more
You can follow by Newsletter or RSS! (What's RSS?) Full archive here.

    These ROCK

    Going after sketching more from life with these big hunky rocks.

    🤘

    Migrating a React App To TypeScript

    After 10 years on the scene, TypeScript has become an essential tool in many codebases.

    The benefits are primarily static testing: Similar to C#, you'll get compile time errors regarding type-mismatches.

    Though, most folks I know that use it love it for the DX. VS Code has first class support for TypeScript, providing stellar autocomplete for all objects and classes that are typed in your codebase. Likely, you've already enjoyed the benefits of autocomplete for methods from external libraries that ship with Types.

    Migrating Create React App to TypeScript

    There was a time when getting the tooling for TypeScript up and running was a headache. Not anymore! Many modern frameworks can initialize a project with TypeScript using a simple options flag in the CLI.

    If working with Create React App, migrating is wildly easy. Simply install typescript dependencies, then restart your dev server.

    npm install --save typescript @types/node @types/react @types/react-dom @types/jest

    Opt In

    It's easy to dip your toes into TypeScript because it's an opt in system. The same TypeScript project can have as many JS files in your /src.

    So to get started, simply convert a file.js to file.tsx for react and you're off and running!

    A note here: your bundler may support JS imports without the file name, but you may need to be explicit with TypeScript imports.

    // JS File
    import EditAuthors from './components/EditAuthors';
    
    // TSX Files, will not compile without file extension
    import EditBook from './components/EditBook.tsx';
    import Books from './components/Books.tsx';
    import Book from './components/Book.tsx';

    Package Types

    Again — there was a time where not all packages shipped with Types. Long gone are those days now! When using an external library, you should be able to find info in their documentation about supported types. Here's Formik as an example.

    import { Formik, FormikErrors } from 'formik';
    import { BookSubmitObject } from '../types';
    
     <Formik
        initialValues={initialValues}
        validate={(values: BookSubmitObject) => {
          const errors: FormikErrors<BookSubmitObject> = {};
          // Validate Errors
          if (values.rating > 5 || values.rating < 1) {
            errors.rating = 'Must be within 1 and 5';
          }
          return errors;
        }}
        ...
      >

    So that's getting setup! More on how to actually write with TypeScript another time. 👋

    Picking a Locale — Overcoming the Blank Page with Carl Barks

    A fun rabbit hole I've been down is learning more about "The Good Duck Artist" Carl Barks.

    The Good Duck Artist

    Barks was a self taught cartoonist and an early legend in comics. He's known for his Donald Duck and Scrooge McDuck cartoons. Wickedly talented in every domain within comics — Story, drawing, expression, color, inking — he was also incredibly prolific, releasing comics regularly over a 25 year career.

    The Good Duck

    Interestingly enough, Barks was more widely famous in Danish culture as opposed to the US due to Donald Duck being the lead character in Denmark instead of Mickey Mouse. Hence, why one of my top searches for "Carl Barks Interviews" brought me to a Danish recording:

    Watch on YouTube

    Aside from how lighthearted Barks is about his work and characters, my favorite part of the interview comes from the question of how he came up with all of these stories:

    "I would just start thinking of what I would like to draw. Because those comic book stories required a great number of hours of drawing and if I could think of some pleasant place — a south sea island or trip into the mountains — something that would give me some good backgrounds and interesting things to draw, then I would chose that as the locale of my store. Then once I've chosen the locale... somehow the ideas for a story, something for those ducks to do, would just come about! The ideas would just pour down onto my head."

    I've heard elsewhere that Barks would use National Geographic issues as reference and inspiration for these far-flung adventures.

    From his Biography, Terry Pratchett described in his process having a horizon off in the distance. He didn't always know how he was going to hit certain story beats, but having a destination helped move the story there.

    My biggest case of "fearing the blank page" comes with writing music. Something about music being less physical makes it a bit more daunting to get started on. But stories really aren't so different. Nothing helps me kick start a song quicker than deciding on a "locale" — be it genre, a pallet of instruments, or even just a song title.

    As is my contractual obligation to say in these posts: So it is with anything creative. Starting with a title helps with writing. Starting with a subject matter helps with drawing. Starting with an app idea helps with software.

    Starting an adventure is easier once you've settled on a point of departure.

    Spanish Melody

    Listen on Youtube

    Picked up a new book for this pretty instrument.

    Moose!

    Inspired by Miranda playing Zelda Tears of the Kingdom. She's been on a mission to hunt down any moose she sees!

    I see your *point*