Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TypeScript config to strict mode #103

Merged
merged 8 commits into from
Aug 9, 2023
Merged

Update TypeScript config to strict mode #103

merged 8 commits into from
Aug 9, 2023

Conversation

dpiatek
Copy link
Contributor

@dpiatek dpiatek commented Aug 7, 2023

Make the codebase follow strict TypeScript rules.

@dpiatek dpiatek changed the title Update ts Update TypeScript config to strict mode Aug 7, 2023
Copy link

@artismarti artismarti left a comment

Choose a reason for hiding this comment

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

const approval: boolean = true;

@dpiatek dpiatek force-pushed the mmb-178-add-members-namespace branch 2 times, most recently from d4d0013 to 33c5990 Compare August 8, 2023 07:16
Base automatically changed from mmb-178-add-members-namespace to main August 8, 2023 07:17
dpiatek pushed a commit that referenced this pull request Aug 9, 2023
This only until the updates from #103 are merged.
dpiatek pushed a commit that referenced this pull request Aug 9, 2023
This only until the updates from #103 are merged.
Dominik Piatek added 8 commits August 9, 2023 16:56
Update as newer types were incompatible.
This commit changes how we handle updates for presence spaces. An presence update becomes a PresenceMember:

export type PresenceMember = {
  data: {
    profileUpdate: {
      id: string | null;
      current: ProfileData;
    };
    locationUpdate: {
      id: string | null;
      previous: unknown;
      current: unknown;
    };
  };
} & Omit<Types.PresenceMessage, 'data'>;

Which then gets translated for the developer to a SpaceMember:

export type SpaceMember = {
  clientId: string;
  connectionId: string;
  isConnected: boolean;
  profileData: ProfileData;
  location: unknown;
  lastEvent: {
    name: Types.PresenceAction;
    timestamp: number;
  };
};

data on PresenceMember contains the last update for profileData an location. The current key is the value of these properties on SpaceMember.

profileUpdate and locationUpdate contain an id. This id is set on publish, but only when we are providing new data, not copying already set data.
The handlers check the id to decide if an update should be emitted (it will still be applied, and it should be the same).
@dpiatek dpiatek merged commit c9bc075 into main Aug 9, 2023
5 checks passed
@dpiatek dpiatek deleted the update-ts branch August 9, 2023 16:23
GregHolmes pushed a commit to GregHolmes/spaces that referenced this pull request Aug 11, 2023
This only until the updates from ably#103 are merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants