You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-15Lines changed: 2 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,21 +40,6 @@ export default defineConfig({
40
40
});
41
41
```
42
42
43
-
For convenience, you may also wish to register aliases for importing the generated files into your application:
44
-
45
-
```ts
46
-
importpathfrom'path';
47
-
48
-
exportdefaultdefineConfig({
49
-
// ...
50
-
resolve: {
51
-
alias: {
52
-
"@": path.resolve(__dirname, "./resources/js"),
53
-
},
54
-
},
55
-
});
56
-
```
57
-
58
43
## Generating TypeScript Definitions
59
44
60
45
The `wayfinder:generate` command can be used to generate TypeScript definitions for your routes and controller methods:
@@ -87,6 +72,8 @@ import { show } from "@/actions/App/Http/Controllers/PostController";
87
72
88
73
show(1); // { url: "/posts/1", method: "get" }
89
74
```
75
+
> [!NOTE]
76
+
> The @ alias can be used for convenience. It's available by default when using [Laravel Vite Plugin](https://github.com/laravel/vite-plugin). To let Typescript also understand this alias, make sure it's configured in your tsconfig.json in the paths section under compilerOptions: `"paths": {"@/*": ["./resources/js/*"]}`.
90
77
91
78
If you just need the URL, or would like to choose a method from the HTTP methods defined on the server, you can invoke additional methods on the Wayfinder generated function:
0 commit comments