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

Route generation generates invalid typescript for routes that includes reserved javascript keywords #31

Closed
aktasumut34 opened this issue Apr 5, 2025 · 2 comments · Fixed by #32

Comments

@aktasumut34
Copy link
Contributor

aktasumut34 commented Apr 5, 2025

Wayfinder Version

0.1.3

Laravel Version

12.0

PHP Version

8.3.17

Description

At first, thank you for your efforts,

When generated route name ends with reserved javascript keywords (delete, export, import etc.), TypeScript throws ts(1389) error which is ... is not allowed as a variable declaration name..

Image

Image

Image

Steps To Reproduce

  • Fresh laravel install
  • Install wayfinder
  • Edit web.php and add a route named import and product.import

Image

  • Run wayfinder
  • See generated output
@timacdonald
Copy link
Member

timacdonald commented Apr 6, 2025

Will close the issue and we can track #32 for the fix.

@TimKunze96
Copy link

TimKunze96 commented Apr 8, 2025

Unfortunately this issue still exists on version v0.1.4.

import delete from './delete'
import update from './update'

const character = {
    delete, 
    update,
}

export default character

I assume this is the root cause for it:

https://github.com/laravel/wayfinder/blob/main/resources/multi-method.blade.ts?l#L10

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

Successfully merging a pull request may close this issue.

3 participants