Skip to content

Commit a1ed1b9

Browse files
committed
Merge branch '2.x' into pr/blade-inline-as-json
2 parents 7169538 + 3016d4f commit a1ed1b9

File tree

7 files changed

+190
-150
lines changed

7 files changed

+190
-150
lines changed

package-lock.json

Lines changed: 183 additions & 145 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"microbundle": "^0.15.1",
6262
"prettier": "^3.3.3",
6363
"typescript": "^5.6.3",
64-
"vitest": "^2.1.4"
64+
"vitest": "^2.1.9"
6565
},
6666
"prettier": {
6767
"printWidth": 100,

src/BladeRouteGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class BladeRouteGenerator
1010
{
1111
public static $generated;
1212

13-
public function generate($group = null, ?string $nonce = null, ?bool $json = false): string
13+
public function generate(array|string|null $group = null, ?string $nonce = null, ?bool $json = false): string
1414
{
1515
$ziggy = new Ziggy($group);
1616

src/Ziggy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Ziggy implements JsonSerializable
2424
protected Collection $routes;
2525

2626
public function __construct(
27-
protected $group = null,
27+
protected array|string|null $group = null,
2828
protected ?string $url = null,
2929
) {
3030
$this->url = rtrim($url ?? url('/'), '/');

src/js/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ interface ParsedQs {
171171
*/
172172
interface Router {
173173
current(): ValidRouteName | undefined;
174-
current<T extends ValidRouteName>(name: T, params?: ParameterValue | RouteParams<T>): boolean;
174+
current<T extends RouteName>(name: T, params?: ParameterValue | RouteParams<T>): boolean;
175175
get params(): Record<string, string>;
176176
get routeParams(): Record<string, string>;
177177
get queryParams(): ParsedQs;

tests/Unit/BladeRouteGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
]);
9090

9191
test('render csp nonce', function () {
92-
expect((new BladeRouteGenerator)->generate(false, 'test-nonce'))
92+
expect((new BladeRouteGenerator)->generate(nonce: 'test-nonce'))
9393
->toContain('<script type="text/javascript" nonce="test-nonce">');
9494
});
9595

tests/js/route.test-d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ assertType(route().has(''));
8989
// Test router getter autocompletion
9090
assertType(route().params);
9191

92+
// These should NOT error in strict mode
93+
assertType(route().current('posts.*'));
9294
assertType(route().current('missing', { foo: 1 }));
9395

9496
// @ts-expect-error missing required 'post' parameter

0 commit comments

Comments
 (0)