Skip to content

fix: resolve TypeScript build errors in console app#1197

Merged
hotlong merged 3 commits intomainfrom
copilot/fix-ci-build-and-test-errors-please-work
Apr 7, 2026
Merged

fix: resolve TypeScript build errors in console app#1197
hotlong merged 3 commits intomainfrom
copilot/fix-ci-build-and-test-errors-please-work

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

Five TypeScript errors in apps/console were failing the CI build (Build Core job). Tests were already passing.

  • objectDetailWidgets.tsxtoObjectDefinition(metadataObject) missing required index arg; added 0 for single-object lookup
  • ObjectManagerListAdapter.tsx — removed unused MetadataObject import
  • SystemHubPage.tsx — removed unused LayoutGrid import; widened HubCard.icon from React.ComponentType<{className?: string}> to React.ElementType to match getIcon() return type
  • metadataConverters.ts — relationship type field was string, now asserted as ObjectDefinitionRelationship['type'] to satisfy the union constraint
# metadataConverters.ts — uses canonical type instead of inline union
-          type: r.type || 'one-to-many',
+          type: (r.type || 'one-to-many') as ObjectDefinitionRelationship['type'],

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui-demo Ready Ready Preview, Comment Apr 7, 2026 10:03am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Apr 7, 2026 10:03am

Request Review

- objectDetailWidgets.tsx: pass required `index` arg to toObjectDefinition()
- ObjectManagerListAdapter.tsx: remove unused MetadataObject import
- SystemHubPage.tsx: remove unused LayoutGrid import
- SystemHubPage.tsx: widen HubCard.icon type to React.ElementType
- metadataConverters.ts: cast relationship type to proper union type

Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/acfc66f8-324c-4b4b-bdeb-08a5b6f52fd6

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix all CI build and test errors fix: resolve TypeScript build errors in console app Apr 7, 2026
Copilot AI requested a review from hotlong April 7, 2026 10:05
@hotlong hotlong marked this pull request as ready for review April 7, 2026 10:21
Copilot AI review requested due to automatic review settings April 7, 2026 10:21
@hotlong hotlong merged commit 01cf1ca into main Apr 7, 2026
4 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes TypeScript build failures in the apps/console app by aligning console-side typings and call sites with the expected @object-ui/types interfaces and utility return types.

Changes:

  • Fix toObjectDefinition() usage by passing the required index argument for single-object conversion.
  • Remove unused imports that were causing TypeScript/ESLint noise.
  • Adjust hub card icon typing to match getIcon()’s return type and satisfy the compiler.
  • Update relationship type conversion to satisfy ObjectDefinitionRelationship['type'] constraints.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
apps/console/src/utils/metadataConverters.ts Updates relationship type conversion to satisfy the ObjectDefinitionRelationship union typing.
apps/console/src/pages/system/SystemHubPage.tsx Removes an unused icon import and widens HubCard.icon typing to accommodate getIcon() results.
apps/console/src/components/schema/objectDetailWidgets.tsx Fixes a missing required argument when converting a single metadata object to ObjectDefinition.
apps/console/src/components/ObjectManagerListAdapter.tsx Removes an unused MetadataObject import from the converters module import list.

Comment on lines 88 to 92
? obj.relationships.map((r) => ({
relatedObject: r.object || r.relatedObject || '',
type: r.type || 'one-to-many',
type: (r.type || 'one-to-many') as ObjectDefinitionRelationship['type'],
label: r.label || r.name || undefined,
foreignKey: r.foreign_key || r.foreignKey || undefined,
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting r.type to ObjectDefinitionRelationship['type'] bypasses the union constraint at compile-time and can let unexpected API values flow into ObjectDefinition.relationships. Consider normalizing/validating r.type against the allowed set ('one-to-one' | 'one-to-many' | 'many-to-one' | 'many-to-many') and falling back to 'one-to-many' when it’s not one of those, instead of a blind type assertion.

Copilot uses AI. Check for mistakes.
Comment on lines 34 to 38
interface HubCard {
title: string;
description: string;
icon: React.ComponentType<{ className?: string }>;
icon: React.ElementType;
href: string;
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HubCard.icon was widened to React.ElementType, but the rendering code uses <Icon className="..." />. ElementType doesn’t guarantee the component accepts className, so this reduces type safety and can mask icon incompatibilities. Prefer a more specific icon type (e.g., LucideIcon from lucide-react or React.ComponentType<{ className?: string }>), and adjust getIcon()’s return type accordingly so call sites stay type-safe.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants