Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type generation for duplicate namespaces #39

Closed
7nohe opened this issue Jul 8, 2024 · 0 comments · Fixed by #40
Closed

Type generation for duplicate namespaces #39

7nohe opened this issue Jul 8, 2024 · 0 comments · Fixed by #40
Assignees
Labels
good first issue Good for newcomers

Comments

@7nohe
Copy link
Owner

7nohe commented Jul 8, 2024

Problem

If you define duplicate namespaces in Laravel’s routing files, the key will be duplicated in the type file generated by laravel-typegen.

web.php

Route::get('/dashboard1', DashboardController::class)->name('dashboard');
Route::get('/dashboard2', DashboardController::class)->name('dashboard');

param.ts

export type RouteParams = {
    "dashboard": {};
    "dashboard": {};
}

Solution

Ensure that a namespace (key) that has been used once during generation is not used again.
If a duplicate is encountered, output a warning and skip it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant