Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Dec 29, 2023
1 parent ddad451 commit 324a782
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
A tiny URL router for [Nano Stores](https://github.com/nanostores/nanostores)
state manager.

* **Small.** 827 bytes (minified and gzipped).
Zero dependencies.
* **Small.** 675 bytes (minified and brotlied). Zero dependencies.
* Good **TypeScript** support.
* Framework agnostic. Can be used with **React**, **Preact**, **Vue**,
**Svelte**, **Angular**, **Solid.js**, and vanilla JS.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@nanostores/router",
"version": "0.11.0",
"description": "A tiny (827 bytes) router for Nano Stores state manager",
"description": "A tiny (675 bytes) router for Nano Stores state manager",
"keywords": [
"nano",
"router",
Expand Down Expand Up @@ -102,14 +102,14 @@
"import": {
"./index.js": "{ createRouter }"
},
"limit": "817 B"
"limit": "675 B"
},
{
"name": "Search Params",
"import": {
"./index.js": "{ createSearchParams }"
},
"limit": "519 B"
"limit": "394 B"
}
],
"clean-publish": {
Expand Down
8 changes: 4 additions & 4 deletions test/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ router.subscribe(page => {
} else if (page.route === 'post') {
// THROWS Property 'type' does not exist on type 'Record<"id", string>'
router.open(`/post/${page.params.type}`)
// THROWS '"exit" | "home" | "create"' and '"creat"' have no overlap
// THROWS '"home" | "exit" | "create"' and '"creat"' have no overlap
} else if (page.route === 'creat') {
console.log('create')
}
Expand All @@ -24,17 +24,17 @@ router.subscribe(page => {
console.log(page.route)
})

// THROWS Argument of type '{ id: string; category: string; }' is not assignable to parameter of type 'Record<"id", string>'.
// THROWS 'category' does not exist in type 'Record<"id", string>'
openPage(router, 'post', { id: '1', category: 'guides' })
// THROWS Expected 2 arguments, but got 3
openPage(router, 'home', { id: '1' })

// THROWS Type 'string' is not assignable to type 'number'.
// THROWS Type 'string' is not assignable to type 'number'
openPage(router, 'create', { id: '1' })
// THROWS Expected 3 arguments, but got 2.
openPage(router, 'create')

// THROWS Argument of type '{ id: string; category: string; }' is not assignable to parameter of type 'Record<"id", string>'.
// THROWS 'category' does not exist in type 'Record<"id", string>'
redirectPage(router, 'post', { id: '1', category: 'guides' })
// THROWS Expected 2 arguments, but got 3
redirectPage(router, 'home', { id: '1' })
Expand Down

0 comments on commit 324a782

Please sign in to comment.