From 170801444dca9f94cdb145335210fa7e287dac5b Mon Sep 17 00:00:00 2001 From: lazerg Date: Thu, 2 Jul 2026 23:37:37 +0500 Subject: [PATCH] Handle boolean true passed to the --types option --- src/CommandRouteGenerator.php | 2 +- tests/Unit/CommandRouteGeneratorTest.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/CommandRouteGenerator.php b/src/CommandRouteGenerator.php index ffb7d83c..7cf52f80 100644 --- a/src/CommandRouteGenerator.php +++ b/src/CommandRouteGenerator.php @@ -51,7 +51,7 @@ public function handle(Filesystem $filesystem) $types = config('ziggy.output.types', Types::class); $typesPath = match ($this->option('types')) { - 'false', null => config('ziggy.output.types-path', "{$name}.d.ts"), + 'false', '1', true, null => config('ziggy.output.types-path', "{$name}.d.ts"), default => $this->option('types'), }; diff --git a/tests/Unit/CommandRouteGeneratorTest.php b/tests/Unit/CommandRouteGeneratorTest.php index b42a4394..da1e5ad5 100644 --- a/tests/Unit/CommandRouteGeneratorTest.php +++ b/tests/Unit/CommandRouteGeneratorTest.php @@ -180,6 +180,13 @@ expect(base_path('resources/js/types.d.ts'))->toBeFile(); }); +test('generate dts file when types option passed as boolean', function () { + artisan('ziggy:generate', ['--types' => true]); + + expect(base_path('resources/js/ziggy.js'))->toBeFile(); + expect(base_path('resources/js/ziggy.d.ts'))->toBeFile(); +}); + test('generate dts file without generating routes file', function () { artisan('ziggy:generate --types-only');