-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* quel bordel * fixed implementation * route pathElements done * Base proto working for router.push * NuxtLink type props POC working * WIP tests, paths working, sort paths, query params and stuff * added hash support, begun fixing tests * finished i18n complex module * fix types * Added router types * test fix flacky test * updated version and complex tests * added tests, fixed behaviours * Fixed types and definePageMeta * Fixed definePageMeta and tests * updated deps * fix tests * Updated tests and fix flacky tests * updated package json * Fixed definePageMeta types * Added support for i18n "prefix_and_default" * Support for only autocompling default routes on localePath * Updated tests and gif * Updated docs
- Loading branch information
1 parent
8628b90
commit 85bd99f
Showing
119 changed files
with
7,316 additions
and
3,169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: definePageMeta() | ||
--- | ||
|
||
|
||
# definePageMeta | ||
|
||
You will have autocompletion and typecheck for multiple properties in `definePageMeta`, both as a global import or from the `@typed-router` alias. | ||
|
||
Like `useRoute`, it has a strict mode when you can assert the current page. | ||
|
||
Properties enabled: | ||
|
||
- `validate` | ||
- `redirect` | ||
- `key` | ||
|
||
::alert{type="warning"} | ||
Do yo Typescript limitations, return type for `redirect` may be buggy or not display anything. | ||
You can use the `helpers` util as a workaround [Helpers doc](./7.helpers.md) | ||
:: | ||
|
||
|
||
Exemple: | ||
|
||
```ts | ||
definePageMeta({ | ||
validate(route) { // <- Typed | ||
return true | ||
} | ||
}) | ||
// Or with strict option | ||
|
||
definePageMeta('admin', { | ||
validate(route) { | ||
route.name // "admin" | ||
return true; | ||
} | ||
}) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: helpers | ||
--- | ||
|
||
# Helpers | ||
|
||
|
||
Alias `@typed-router` exports a `helpers` util that can be useful in places where there is no autocomplete yet. | ||
It simply returns the route you give as argument. | ||
|
||
|
||
## `helpers.route` | ||
|
||
It will give you autocomplete and type check for route object | ||
|
||
```ts | ||
import {helpers} from '@typed-router'; | ||
|
||
const route = helpers.route({name: 'admin-id'}) // Error ❌ | ||
const route = helpers.route({name: 'admin-id', params: {id: 1}}) // Good ✅ | ||
``` | ||
|
||
## `helpers.path` | ||
|
||
It will give you autocomplete and type check for string path | ||
|
||
```ts | ||
import {helpers} from '@typed-router'; | ||
|
||
const route = helpers.path('/admin') // Error ❌ | ||
const route = helpers.path('/admin/1') // Good ✅ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: experimentalPathCheck | ||
--- | ||
|
||
# experimentalPathCheck | ||
|
||
It allows you to disable path autocomplete and typecheck | ||
## Type | ||
`type: boolean` | ||
`default: true` | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
85bd99f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nuxt-typed-router – ./
nuxt-typed-router.vercel.app
nuxt-typed-router-git-master-victorgarciaesgi.vercel.app
nuxt-typed-router-victorgarciaesgi.vercel.app