Skip to content

Consolidate client types to single source#32

Merged
gricha merged 2 commits intomainfrom
refactor/consolidate-client-types
Jan 7, 2026
Merged

Consolidate client types to single source#32
gricha merged 2 commits intomainfrom
refactor/consolidate-client-types

Conversation

@gricha
Copy link
Copy Markdown
Owner

@gricha gricha commented Jan 7, 2026

Summary

  • Add @shared path alias in Vite and TypeScript configs
  • Web now imports types directly from src/shared/client-types.ts instead of using a build-time copy
  • Remove the fragile cp src/shared/client-types.ts web/src/lib/types.ts command from build:web

Why

The previous approach copied client-types.ts to web/src/lib/types.ts at build time. This was fragile because:

  • Types could drift if someone forgot to rebuild
  • Changes to client-types.ts weren't immediately reflected in web during dev
  • It was a source of duplication

Changes

  • web/vite.config.ts: Add @shared alias pointing to ../src/shared
  • web/tsconfig.app.json: Add @shared/* path and include ../src/shared
  • web/src/lib/api.ts: Import types from @shared/client-types
  • web/src/lib/types.ts: Replace with single-line re-export from @shared/client-types
  • package.json: Remove cp command from build:web script

Test plan

  • bun run validate passes all tests
  • Web build works correctly
  • Playwright E2E tests pass

🤖 Generated with Claude Code

gricha and others added 2 commits January 7, 2026 18:13
- Add @shared path alias in Vite and TypeScript configs to import from
  parent src/shared directory
- Update web/src/lib/api.ts to import types from @shared/client-types
- Replace web/src/lib/types.ts with simple re-export from @shared
- Remove cp command from build:web script in package.json

Web now imports types directly from src/shared/client-types.ts instead
of using a build-time copy. This eliminates type drift between source
and web builds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update Sidebar.tsx, WorkspaceDetail.tsx, and WorkspaceList.tsx to import
HOST_WORKSPACE_NAME directly from @shared/client-types instead of the
now-removed @/lib/types path.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gricha gricha merged commit 99f5577 into main Jan 7, 2026
6 checks passed
@gricha gricha deleted the refactor/consolidate-client-types branch January 7, 2026 18:32
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.

1 participant