Looking to hire Laravel developers? Try LaraJobs

laravel-typefinder maintained by pentacore

Description
Auto-generate TypeScript type definitions from Laravel Models, Enums, Casts, and Requests.
Author
Martin Claesson
Last update
2026/05/15 08:37 (dev-dependabot/npm_and_yarn/development/semantic-release/github-12.0.8)
License
Downloads
567

Comments
comments powered by Disqus

Laravel Typefinder

Laravel Typefinder auto-generates TypeScript type definitions (.d.ts files) from your Laravel application's Models, Enums, Form Requests, and Casts. It introspects your database schema, cast declarations, validation rules, and relationships to produce accurate, always-fresh types — no manual maintenance required.

Packages

Package Install
pentacore/laravel-typefinder composer require pentacore/laravel-typefinder
@pentacore/vite-plugin-laravel-typefinder npm i -D @pentacore/vite-plugin-laravel-typefinder

Quick start

1. Install the Composer package:

composer require pentacore/laravel-typefinder

2. Register the Vite plugin (vite.config.js):

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import typefinder from '@pentacore/vite-plugin-laravel-typefinder';

export default defineConfig({
    plugins: [
        laravel({ input: ['resources/js/app.js'] }),
        typefinder(),
    ],
});

3. Generate types:

php artisan typefinder:generate

Types are written to resources/js/types/ by default. The Vite plugin re-runs generation automatically on HMR file changes.

Documentation

Full documentation for each package:

Development

# Install PHP dependencies
composer install

# Install JS dependencies
npm install

# Run PHP tests
vendor/bin/phpunit

# Check PHP code style
vendor/bin/pint --test

# Build the Vite plugin
npm -w packages/vite-plugin-laravel-typefinder run build

# Lint the Vite plugin
npm -w packages/vite-plugin-laravel-typefinder run lint

See CONTRIBUTING.md for full contributor guidelines.

License

MIT — see LICENSE.