|
1 | 1 | @include('wayfinder::docblock')
|
2 |
| -{!! when(($export ?? true) && !$isInvokable, 'export ') !!}const {!! $method !!} = (@include('wayfinder::function-arguments')): { |
3 |
| - url: string, |
4 |
| - method: @js($verbs->first()->actual), |
5 |
| -} => ({ |
| 2 | +{!! when(($export ?? true) && !$isInvokable, 'export ') !!}const {!! $method !!} = (@include('wayfinder::function-arguments')): RouteDefinition<@js($verbs->first()->actual)> => ({ |
6 | 3 | url: {!! $method !!}.url({!! when($parameters->isNotEmpty(), 'args, ') !!}options),
|
7 | 4 | method: @js($verbs->first()->actual),
|
8 | 5 | })
|
9 | 6 |
|
10 | 7 | {!! $method !!}.definition = {
|
11 |
| - methods: [@foreach ($verbs as $verb)@js($verb->actual){!! when(! $loop->last, ',') !!}@endforeach], |
| 8 | + methods: {!! $verbs->pluck('actual')->toJson() !!}, |
12 | 9 | url: {!! $uri !!},
|
13 |
| -} |
| 10 | +} satisfies RouteDefinition<{!! $verbs->pluck('actual')->toJson() !!}> |
14 | 11 |
|
15 | 12 | @include('wayfinder::docblock')
|
16 | 13 | {!! $method !!}.url = (@include('wayfinder::function-arguments')) => {
|
|
69 | 66 |
|
70 | 67 | @foreach ($verbs as $verb)
|
71 | 68 | @include('wayfinder::docblock')
|
72 |
| -{!! $method !!}.{!! $verb->actual !!} = (@include('wayfinder::function-arguments')): { |
73 |
| - url: string, |
74 |
| - method: @js($verb->actual), |
75 |
| -} => ({ |
| 69 | +{!! $method !!}.{!! $verb->actual !!} = (@include('wayfinder::function-arguments')): RouteDefinition<@js($verb->actual)> => ({ |
76 | 70 | url: {!! $method !!}.url({!! when($parameters->isNotEmpty(), 'args, ') !!}options),
|
77 | 71 | method: @js($verb->actual),
|
78 | 72 | })
|
79 | 73 | @endforeach
|
80 | 74 |
|
81 | 75 | @if ($withForm)
|
82 | 76 | @include('wayfinder::docblock')
|
83 |
| - const {!! $method !!}Form = (@include('wayfinder::function-arguments')): { |
84 |
| - action: string, |
85 |
| - method: @js($verbs->first()->formSafe), |
86 |
| - } => ({ |
| 77 | + const {!! $method !!}Form = (@include('wayfinder::function-arguments')): RouteFormDefinition<@js($verbs->first()->formSafe)> => ({ |
87 | 78 | action: {!! $method !!}.url(
|
88 | 79 | {!! when($parameters->isNotEmpty(), 'args, ') !!}
|
89 | 80 | @if ($verbs->first()->formSafe === $verbs->first()->actual)
|
|
102 | 93 |
|
103 | 94 | @foreach ($verbs as $verb)
|
104 | 95 | @include('wayfinder::docblock')
|
105 |
| - {!! $method !!}Form.{!! $verb->actual !!} = (@include('wayfinder::function-arguments')): { |
106 |
| - action: string, |
107 |
| - method: @js($verb->formSafe), |
108 |
| - } => ({ |
| 96 | + {!! $method !!}Form.{!! $verb->actual !!} = (@include('wayfinder::function-arguments')): RouteFormDefinition<@js($verb->formSafe)> => ({ |
109 | 97 | action: {!! $method !!}.url(
|
110 | 98 | {!! when($parameters->isNotEmpty(), 'args, ') !!}
|
111 | 99 | @if ($verb->formSafe === $verb->actual)
|
|
0 commit comments