Fix 6 more warnings (unnecessary conditions and nullish coalescing)

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-06 20:55:11 +00:00
parent bd0164b52f
commit fb2fdcda5b
2 changed files with 6 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ export async function getComponentHierarchy(): Promise<Record<string, ComponentN
hierarchy[node.id] = {
id: node.id,
type: node.type,
parentId: node.parentId !== null && node.parentId !== undefined ? node.parentId : undefined,
parentId: node.parentId ?? undefined,
childIds: JSON.parse(node.childIds) as string[],
order: node.order,
pageId: node.pageId,

View File

@@ -19,22 +19,22 @@ const PACKAGE_COMPONENT_REGISTRY: Record<string, Record<string, ComponentDef>> =
* and a `components` array (or object) with component definitions.
*/
export function loadPackageComponents(packageContent: JsonValue): void {
if (packageContent === null || packageContent === undefined || typeof packageContent !== 'object') return
if (typeof packageContent !== 'object' || packageContent === null) return
const pkg = packageContent as JsonObject
const metadata = pkg?.metadata
const metadata = pkg.metadata
const packageId =
(metadata !== null && metadata !== undefined && typeof metadata === 'object' && !Array.isArray(metadata)
? (metadata as JsonObject)['packageId']
: undefined) ??
pkg?.['package'] ??
pkg?.['packageId']
pkg['package'] ??
pkg['packageId']
if (packageId === null || packageId === undefined || typeof packageId !== 'string') return
const compsArray: JsonValue[] =
Array.isArray(pkg.components) && pkg.components.length > 0
? pkg.components
: Array.isArray((pkg.ui as JsonObject)?.components)
: Array.isArray((pkg.ui as JsonObject | undefined)?.components)
? ((pkg.ui as JsonObject).components as JsonValue[])
: []