Skip to content

Commit

Permalink
fix(Group): explicitly define sourceId for all group variants (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
BugGambit authored Apr 11, 2024
1 parent d599890 commit 220b7c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/stable/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,14 @@ export interface ManagedExternallyGroup extends BaseGroup {

export interface ManagedInCDFGroup extends BaseGroup {
members: GroupMembers;
// We are adding `sourceId: undefined` because this code:
// const foo(bar: Group) => console.log(bar.sourceId)
// yields the error:
// `Property 'sourceId' does not exist on type 'ManagedInCDFGroup'.`
// The Group type is defined as `type Group = ManagedInCDFGroup | ManagedExternallyGroup`
// and `sourceId` isn't defined on `ManagedInCDFGroup`.
// Typescript fails even though `sourceId` is an optional field on `ManagedExternallyGroup`.
sourceId: undefined;
}

export type Group = ManagedInCDFGroup | ManagedExternallyGroup;
Expand Down

0 comments on commit 220b7c1

Please sign in to comment.