Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

Practical TypeScript for the Laravel Developer

In this series, we are going to learn about the typical situations you will encounter when building a Laravel app with a TypeScript frontend. We'll talk about TypeScript primitives, how to organize your types, when to type, and, ultimately, how to generate types from your PHP code. All signal, no noise!

Series trailer thumbnail

Progress

Series Info

Episodes
15
Run Time
1h 22m
Difficulty
Intermediate
Last Updated
Dec 16, 2025
Version
Latest

Series Episodes

  1. Getting Started (2)
    1. Intro + Setup

      Let's get started! We'll talk about why we may want to use TypeScript in the first place and how it benefits you during development. Then we'll dive into configuring TypeScript for your application and converting the app entry point.
    2. TypeScript Basics

      Before converting our components to TypeScript, let's take a moment to talk about the basic primitives we'll be using to add type safety to our client side code.
  2. Typing Your Components (4)
    1. Inertia Props

      The first step in converting our Edit component is to add types to our component props, in this case, the props being passed to the component via Inertia. We'll learn how to take our PHP data and convert it to the equivalent types in TypeScript.
    2. Form Requests

      We'll look at the Inertia useForm hook and use the provided generic to ensure that the outgoing form request matches the validation expected by the server.
    3. Side Quest: Form Handlers

      We've added a lot of type safety to our Edit component, but we still have some stragglers that have red squiggles: form and input handlers. Let's tackle them.
    4. Adding Types to Laravel Echo and Stream Hooks

      It's very possible that you'll use Laravel's first party Echo and Stream hooks in your application. Let's learn how to increase our type safety and IDE intelligence when using these hooks.
  3. Organization and Utilities (2)
    1. Where Should Everything Go?

      Our component is looking a bit verbose. Let's clean it up! We'll introduce a couple of strategies regarding how to organize your types to maximize usability and readability.
    2. TypeScript Utilities

      We're going a bit deeper on this one. We'll use TypeScript utilities such as Pick, Required, Omit, and Partial to re-use our existing types in creative ways.
  4. TypeScript Patterns (4)
    1. Vanilla TS

      Sometimes you're not working in the context of a component! We explore how to add type safety around two common HTTP concepts: axios and fetch.
    2. Vue Example

      React shouldn't have all the fun. Let's convert our Edit.vue component to TypeScript so you can see how Vue handles type safety.
    3. Typing Common React Hooks

      Let's explore common React hooks such as useRef, useState, and useMemo and figure out how to enhance them with TypeScript where it makes sense.
    4. Typing Common Vue Functions

      You're likely to use Vue functions such as ref and computed, let's learn how to add some type safety where it makes sense.
  5. Automatic Type Generation (2)
    1. Generating Types with Laravel Data and TypeScript Transformer

      Up until this point we've been manually writing our types. Let's generate them automatically using two packages from Spatie by specifying which PHP classes we'd like converted to TypeScript.
    2. Generating Types with Laravel Wayfinder

      Now let's generate every type you can think of in your Laravel app, automatically, with Laravel Wayfinder. We'll explore the benefits of automatic type generation and how to incorporate Wayfinder into your local dev process.
  6. Wrap Up (1)
    1. Outro

      This is goodbye for now. I hope you move forward feeling more confident about using TypeScript in your frontend code and understand the importance of end-to-end type safety and the added IDE intelligence.

Continue Learning