Skip to content

Formalize skipReason in ProviderAdapter return type #295

@mschilling

Description

@mschilling

Both GitHub and Azure DevOps adapters use { skipReason: string } as any / as Partial<GameAction> to signal that an event should be skipped. This works but bypasses type safety.

Proposal: Update the ProviderAdapter.mapEventToGameAction return type to:

type MapResult = Partial<GameAction> | { skipReason: string } | null;

And update GameActionService to check for the discriminated union properly.

Affected files:

  • libs/server/integrations/src/lib/providers/interfaces/provider.interface.ts
  • libs/server/integrations/src/lib/providers/github/github.adapter.ts (10+ occurrences)
  • libs/server/integrations/src/lib/providers/azure-devops/adapter.ts (2 occurrences)
  • libs/server/integrations/src/lib/services/game-action.service.ts

Ref: PR #293 review feedback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions