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
Since 2.5.0 I now get a typescript error with the below code when using strict mode: Type 'string & {}' is not assignable to type 'keyof RouteList'.
Suggested fix:
/**
* Ziggy's Router class.
*/
interface Router {
current(): RouteName | undefined; // Change this to ValidRouteName
current<T extends RouteName>(name: T, params?: ParameterValue | RouteParams<T>): boolean;
get params(): Record<string, string>;
get routeParams(): Record<string, string>;
get queryParams(): ParsedQs;
has<T extends RouteName>(name: T): boolean;
}
Also I believe it would be valuable to export the ValidRouteName type definition (and perhaps some others) so it can be used for wrapper / helper code. In this situation I would be able to make a type assertion if the suggested fix is not viable for some reason.
Ziggy version
v.2.5.0
Laravel version
v11.39.1
Description
Related to: 5dc7a0e
Since 2.5.0 I now get a typescript error with the below code when using strict mode: Type 'string & {}' is not assignable to type 'keyof RouteList'.
Suggested fix:
Also I believe it would be valuable to export the ValidRouteName type definition (and perhaps some others) so it can be used for wrapper / helper code. In this situation I would be able to make a type assertion if the suggested fix is not viable for some reason.
Ziggy call and context
Ziggy configuration
//
Route definition
//
The text was updated successfully, but these errors were encountered: