Check out this TypeScript wrapper for vue-router
:
abstract class RoutingHelper {
// ...
public static redirectToNamedRoute(targetRouteName: AnyValueOf<typeof NamedRoutes>): Promise<void> {
return new Promise<void>((resolve: () => void): void => {
router.push({ name: targetRouteName }, resolve);
});
}
}
The rule @typescript-eslint/promise-function-async enforces that method returning a Promise
must be async
:
public static async redirectToNamedRoute(targetRouteName: AnyValueOf<typeof NamedRoutes>): Promise<void> {
return new Promise<void>((resolve: () => void): void => {
router.push({ name: targetRouteName }, resolve);
});
}
Now, according to require-await, the method must include the await
keyword. How can I implement require-await
in this method?