Skip to content

refac: dx: Created shared types package to eliminate type duplication#283

Open
Chongai-Cli wants to merge 1 commit into
XStreamRollz:mainfrom
Chongai-Cli:refac
Open

refac: dx: Created shared types package to eliminate type duplication#283
Chongai-Cli wants to merge 1 commit into
XStreamRollz:mainfrom
Chongai-Cli:refac

Conversation

@Chongai-Cli

Copy link
Copy Markdown
Contributor

Summary

Provide a short description of the changes in this PR and the motivation/why.

Modified files:

  • package.json — added packages/types to workspaces
  • xstreamroll-sdk/package.json — added
    @xstreamroll/types: "*" dependency
  • xstreamroll-sdk/src/types.ts — replaced inline
    definitions with re-exports from @xstreamroll/types;
    StreamConfig stays local (SDK-specific)
  • api/package.json — added @xstreamroll/types: "*"
    dependency
  • api/src/admin/admin-stats.service.ts — imports
    AdminStats from @xstreamroll/types instead of
    defining it
  • api/src/streams/stream.entity.ts — keeps internal
    DB shape (number IDs, Date), re-exports shared
    stream helper types
  • api/src/tags/tag.entity.ts — keeps internal DB
    shape, re-exports PagedTags
  • app/package.json — added @xstreamroll/types: "*"
    dependency
  • app/lib/api/tags.ts — removes Tag/PagedTags
    definitions, re-exports from @xstreamroll/types
  • app/lib/api/admin-stats.ts — removes AdminStats
    definition, re-exports from @xstreamroll/types
  • app/lib/api/notifications.ts — removes
    Notification/NotificationsPage definitions,
    re-exports from @xstreamroll/types
  • app/tsconfig.json, api/tsconfig.json,
    xstreamroll-sdk/tsconfig.json — added paths alias
    for @xstreamroll/types →
    ../packages/types/src/index.ts

Related issues

Link any related issues. Use Closes #<id> to close issues automatically.

Closes #206

Type of change

  • feat
  • [x ] fix
  • docs
  • chore
  • test
  • ci

Match the PR title to Conventional Commits: <type>(<scope>): <summary>.

Testing performed

Describe how you tested this change. Include commands, environment, and any setup steps.

Example:

cd api
npm run lint
npm run build
npm test

Screenshots (if applicable)

Attach screenshots or animated GIFs for UI changes.

Checklist — author

  • [x ] I rebased onto origin/main and resolved conflicts.
  • [ x] I ran the quality gates locally: npm run lint, npm run build, npm test.
  • [x ] Title follows Conventional Commits and references the issue (see above).
  • [ x] I added/updated tests where applicable and they pass locally.
  • [ x] No new TypeScript errors or lint warnings introduced.
  • [ x] I updated documentation if the change affects public behavior.
  • Screenshots included for UI changes.

Checklist — reviewer guidance

  • Required checks: lint, build, unit tests, and any package-specific E2E must be green.
  • Request review from CODEOWNER(s) for touched packages.
  • Prefer small, focused PRs. If large, confirm feature-flagging or follow-up tasks.

Follow the full PR process in CONTRIBUTING.md — particularly: sync with main, run quality gates, request a CODEOWNER review, and use squash-and-merge with a Conventional Commit-style squash message.

@Xhristin3 Xhristin3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the refactor — consolidating types into @xstreamroll/types is a great move. Holding on merge because the quality CI is red:\n\nnpx tsc --noEmit is failing with TS6059 in the api workspace. The new package lives at packages/types/src/, but api/tsconfig.json's rootDir is still ./src, so the compiler treats those files as 'outside of rootDir'.\n\nFix options (pick one):\n- expand api/tsconfig.json rootDir to include ../packages/types/src (and add it to include), or\n- build @xstreamroll/types first and point paths/baseUrl at its dist instead of src, or\n- mark @xstreamroll/types as composite + references and use project references.\n\nRe-request review once tsc --noEmit is green on the api workspace. 🙏

@Xhristin3 Xhristin3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for taking on this refactor — looks like a solid step toward de-duplicating types. Unfortunately the CI quality check is failing on this branch. Could you take a look at the failing logs and push a fix? Happy to merge once it's green.

Copy link
Copy Markdown
Contributor

Hey @Chongai-Cli \u2014 great refactor idea; consolidating shared types into @xstreamroll/types will pay off across the workspace. CI is currently red on tsc --noEmit because api/tsconfig.json isn't picking up the new package (TS6059). Could you either expand rootDir/include to cover ../packages/types/src, set up paths/baseUrl against the built dist, or switch to TS project references (composite + references)? Once CI is green, this is good to go \u2014 almost there! \ud83d\ude80

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.

dx: Create shared types package to eliminate type duplication

2 participants