vuejs/vue-router

The type definition of Route seems to be partially wrong

Open

#3,566 建立於 2021年6月9日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)JavaScript (5,092 fork)batch import
Typescriptcontribution welcomefixed on 4.xgood first issue

倉庫指標

Star
 (19,015 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Version

3.5.1

Reproduction link

https://github.com/vuejs/vue-router/blob/dev/types/router.d.ts#L203

Steps to reproduce

None, just the source code seems to be wrong.

What is expected?

The type definition of Route#query should be

query: Dictionary<string | null | (string | null)[]>

The current implementation cannot express this type of query

/path?foo#bar

as it doesn't have any value and it is not converted to an array.

What is actually happening?

https://github.com/vuejs/vue-router/blob/dev/types/router.d.ts#L203

The type definition of Route#query is

query: Dictionary<string | (string | null)[]>

貢獻者指南