Skip to content

refactor(sync-engine): replace unsafe any type with generic parameter in SyncJob payload (#36)#39

Open
rohansaini-02 wants to merge 1 commit into
theapprenticeproject:mainfrom
rohansaini-02:feature/sync-job-generic-payload-standalone
Open

refactor(sync-engine): replace unsafe any type with generic parameter in SyncJob payload (#36)#39
rohansaini-02 wants to merge 1 commit into
theapprenticeproject:mainfrom
rohansaini-02:feature/sync-job-generic-payload-standalone

Conversation

@rohansaini-02

Copy link
Copy Markdown

Summary

This PR replaces the unsafe any type with a generic parameter T (defaulting to unknown) in SyncJob and SyncQueue within the poc-sync-engine package to guarantee compile-time type safety.

Related Issue

Resolves #36

Changes Made

  • Type Safety: Parameterized SyncJob<T = unknown> and SyncQueue<T = unknown> to replace the unsafe payload: any typing.
  • Propagated Types: Updated SyncManager<T = unknown> and its helper methods to correctly use and forward the typed generic payload.
  • Expanded Test Coverage: Added a new unit test in SyncManager.test.ts that instantiates a typed SyncQueue with a custom payload interface and validates that types are preserved upon retrieval.

Testing Performed

  • Ran the unit tests in poc-sync-engine:
    npm test
    All 4 tests compile and pass successfully.

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.

refactor(sync-engine): replace unsafe any type with generic parameter in SyncJob payload

1 participant