DataTypeis imported from@dxos/schemabut is not actually exported from that package- This causes TypeScript errors as seen in the diagnostics
- The code uses
DataTypeas a namespace to access various types likeDataType.Organization.Organization
Based on the analysis, the types are split between two packages:
- Organization
- Person
- Task
- Project
- Event
- Message
- ContentBlock
- Actor
- Geo
- Collection
- View
- Text
- StoredSchema
Replace DataType namespace with direct imports:
// Before
import { DataType } from '@dxos/schema';
const org = DataType.Organization.Organization;
// After
import { Organization } from '@dxos/types';
const org = Organization.Organization;Create a barrel export that recreates the DataType namespace:
// In some central location (e.g., @dxos/schema/src/index.ts)
import * as Organization from '@dxos/types/Organization';
import * as Person from '@dxos/types/Person';
// ... etc
export const DataType = {
Organization,
Person,
// ... etc
};- ~200 files across the codebase use DataType
- Most common usage patterns:
- DataType.Organization.Organization
- DataType.Person.Person
- DataType.Task.Task
- DataType.Collection.Collection
- DataType.View.View
- DataType.Text.Text
- DataType.Message.Message
- Decide on refactoring approach
- Update imports in all affected files
- Run tests to ensure nothing breaks
- Update any documentation