refactor: ensure all types are using index signature instead of Record (#6995)

* refactor: ensure all types are using index signature instead of Record

* kick CI
This commit is contained in:
Joshua Chen 2022-03-25 18:06:30 +08:00 committed by GitHub
parent e8800b9d49
commit 87592bca03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 339 additions and 307 deletions

View file

@ -23,11 +23,11 @@ import type {
// ie the docs of that plugin are currently browsed
// it is useful to support multiple docs plugin instances
export function getActivePlugin(
allPluginDatas: Record<string, GlobalPluginData>,
allPluginData: {[pluginId: string]: GlobalPluginData},
pathname: string,
options: GetActivePluginOptions = {},
): ActivePlugin | undefined {
const activeEntry = Object.entries(allPluginDatas)
const activeEntry = Object.entries(allPluginData)
// Route sorting: '/android/foo' should match '/android' instead of '/'
.sort((a, b) => b[1].path.localeCompare(a[1].path))
.find(
@ -46,7 +46,7 @@ export function getActivePlugin(
if (!activePlugin && options.failfast) {
throw new Error(
`Can't find active docs plugin for "${pathname}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(
allPluginDatas,
allPluginData,
)
.map((plugin) => plugin.path)
.join(', ')}`,