Bug Description
There is a type mismatch between CollectionInfo and the expected type in LinkedData.collections, causing TypeScript compilation errors in the charts-core module.
Affected Files
-
components/ui/components/CollectionSelector/CollectionSelector.tsx (Line 5-8)
CollectionInfo type only defines id and name properties
-
lib/charts-core/parameters/resolver.ts (Lines 106, 109)
- Code assigns objects with
public property to linkedData.collections
- Creates fallback object:
{ id: parseInt(param), public: false, name: 'Unknown' }
-
lib/charts-core/parameters/react/collection-id/index.tsx (Line 12)
- Error: Property 'public' is missing in type 'CollectionInfo'
TypeScript Errors
lib/charts-core/parameters/react/collection-id/index.tsx(12,7): error TS2741: Property 'public' is missing in type 'CollectionInfo' but required in type '{ id: number; name: string; public: boolean; }'.
lib/charts-core/parameters/resolver.ts(106,18): error TS2322: Type 'Promise<Collection | { id: number; public: false; name: string; }>' is not assignable to type 'Promise<{ id: number; name: string; public: boolean; }>'.
Root Cause
The LinkedData type in lib/charts-core/parameters/resolver.ts defines:
collections: Record<string, { id: number, name: string, public: boolean }>
But CollectionInfo in CollectionSelector.tsx only has:
export type CollectionInfo = {
id: number;
name: string;
};
Suggested Fix
Option 1: Add public property to CollectionInfo:
export type CollectionInfo = {
id: number;
name: string;
public?: boolean; // Make optional since API doesn't always return it
};
Option 2: Update the API response to include public property and modify searchCollections to fetch it.
Impact
- Prevents strict TypeScript compilation
- Type safety is compromised in collection-related code
- May hide other type-related bugs
Priority
Medium - Doesn't cause runtime errors (JavaScript ignores extra properties) but reduces type safety and code quality.
Bug Description
There is a type mismatch between
CollectionInfoand the expected type inLinkedData.collections, causing TypeScript compilation errors in the charts-core module.Affected Files
components/ui/components/CollectionSelector/CollectionSelector.tsx (Line 5-8)
CollectionInfotype only definesidandnamepropertieslib/charts-core/parameters/resolver.ts (Lines 106, 109)
publicproperty tolinkedData.collections{ id: parseInt(param), public: false, name: 'Unknown' }lib/charts-core/parameters/react/collection-id/index.tsx (Line 12)
TypeScript Errors
Root Cause
The
LinkedDatatype inlib/charts-core/parameters/resolver.tsdefines:But
CollectionInfoinCollectionSelector.tsxonly has:Suggested Fix
Option 1: Add
publicproperty toCollectionInfo:Option 2: Update the API response to include
publicproperty and modifysearchCollectionsto fetch it.Impact
Priority
Medium - Doesn't cause runtime errors (JavaScript ignores extra properties) but reduces type safety and code quality.