[TypeScript] LocaleRoute should return Location
See original GitHub issueVersion
nuxt-i18n: 6.12.2 nuxt: 2.13.1
What is the problem ?
From vue-router type definitions:
push(location: RawLocation): Promise<Route>
replace(location: RawLocation): Promise<Route>
Those methods expect type RawLocation = string | Location
but localeRoute from nuxt-i18n returns Route
object which is slightly different from Location
Solution expected
localeRoute(route: RawLocation, locale?: string): Route | undefined
- should become
localeRoute(route: RawLocation, locale?: string): Location | undefined
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
[TypeScript] LocaleRoute should return Location #776 - GitHub
Version nuxt-i18n: 6.12.2 nuxt: 2.13.1 What is the problem ? From vue-router type definitions: push(location: RawLocation): Promise ...
Read more >Angular: How to redirect to a given url if variable is present in ...
I want that next time if I load the application, it should check to see if ... localePath) { return; } else {...
Read more >Basic Usage - i18n-module
It works like localePath but returns Location resolved by Vue Router rather than just a full route path. This can be useful since...
Read more >The Ultimate Vue Localization Guide | Phrase
Dive into Vue localization and learn how to plug the Vue I18n library into your app, so you can make it accessible to...
Read more >next/router NextRouter TypeScript Examples
This page shows TypeScript code examples of next/router NextRouter. ... window.location.href = url as string; return true; } route = '/'; }. Example...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Changed my mind. Leaving
localeRoute
behavior unchanged and return type changed to reflect the reality (Route
), and addedlocaleLocation
API that returnsLocation
.Changing the return type to
Location
. I think the primary use case is to use it with router.push but then it’s probably a bit badly named. But too late to change that now.