Skip to content

Fix: Resolve compilation type errors in MessageContext.tsx #222

Description

@MohitBareja16

Problem

The MessageContext.tsx file contains TypeScript inconsistencies that cause active compilation errors:

  1. optimisticMessage.senderId strictly expects a string, but currentUser.id is typed as string | undefined.
  2. The MessageContextType interface defines markAllAsSeen as returning a Promise<any>, but its actual implementation in the component returns void.

These mismatches prevent the application from successfully building and fail the strict typing guarantees.

Solution

  1. Add an empty string fallback (currentUser.id || "") when instantiating the optimistic message to guarantee a string assignment.
  2. Update the MessageContextType interface so that markAllAsSeen explicitly returns void, correctly aligning the contract with the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gssoc:approvedApproved for GirlScript Summer of Code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions