From 15047da68a2ab6fff15aa43d7783031d0c835d9c Mon Sep 17 00:00:00 2001 From: Andrew Jakubowicz Date: Thu, 4 May 2023 09:48:24 -0700 Subject: [PATCH] Small code cleanup that would get caught in code review --- .../lit-dev-tools-cjs/src/api-docs/transformer.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts b/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts index 64ea76b32..dd096f9a7 100644 --- a/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts +++ b/packages/lit-dev-tools-cjs/src/api-docs/transformer.ts @@ -106,9 +106,7 @@ export class ApiDocsTransformer { symbolMap: SymbolMap; pages: Pages; }> { - this.addKindStringsBackToAllNodes( - this.project as unknown as Record - ); + this.addKindStringsBackToAllNodes(this.project); // In the first pass, determine the page/anchor where each node should // appear in our layout, and index all nodes by TypeDoc numeric ID. for (const entrypoint of this.project.children ?? []) { @@ -694,7 +692,7 @@ export class ApiDocsTransformer { * api.html. This method recursively walks the TypeDoc node and adds * `kindString` back to all nodes with a valid `kind` field. */ - private addKindStringsBackToAllNodes(node: Record) { + private addKindStringsBackToAllNodes(node: unknown) { if (typeof node !== 'object' || node == null) { return; } @@ -707,11 +705,10 @@ export class ApiDocsTransformer { for (const [key, val] of Object.entries(node)) { if (key === 'kind' && typeof val === 'number') { // Add a `kindString` field to the node. - node['kindString'] = typedoc.ReflectionKind.singularString( - val as ReflectionKind - ); + (node as {kindString: string})['kindString'] = + typedoc.ReflectionKind.singularString(val as ReflectionKind); } - this.addKindStringsBackToAllNodes(val as Record); + this.addKindStringsBackToAllNodes(val); } }