Skip to content

Commit 22b456b

Browse files
committed
Fix type definition in route.ts and update tests in route.test.ts
1 parent 7761c11 commit 22b456b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/utils/__tests__/route.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getRouteQuery } from '../route'
44
describe('getRouteQuery', () => {
55
it('should return an object with string values when kind is "val"', () => {
66
const query = {
7-
key1: 123,
7+
key1: '123',
88
key2: 'abc',
99
}
1010
type Query = typeof query
@@ -18,7 +18,7 @@ describe('getRouteQuery', () => {
1818

1919
it('should return an object with number conversion functions when kind is not "val"', () => {
2020
const query = {
21-
key1: 123,
21+
key1: '123',
2222
key2: 'abc',
2323
}
2424
const result = getRouteQuery(query)('fn')

src/utils/route.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// type LocationQueryValue = string | number | null
2-
// export type LocationQuery = Record<string, LocationQueryValue>
32

4-
import type { LocationQuery } from 'vue-router/auto'
3+
import type { LocationQueryValue } from 'vue-router/auto'
4+
5+
type LocationQuery = {
6+
[x: string]: LocationQueryValue | LocationQueryValue[]
7+
}
58

69
type Kind = 'fn' | 'val'
710

0 commit comments

Comments
 (0)