Skip to content

Commit

Permalink
test: adjustments according extended types
Browse files Browse the repository at this point in the history
  • Loading branch information
collierrgbsitisfise committed Sep 30, 2024
1 parent 0247c1e commit af24a59
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/lexical-react/src/__tests__/unit/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ export class Client implements Provider {
_awarenessState: UserState | null = null;
awareness: {
getLocalState: () => UserState | null;
getStates: () => Map<number, UserState>;
getStates: <T extends Record<string, unknown>>() => Map<
number,
UserState & T
>;
off(): void;
on(): void;
setLocalState: (state: UserState) => void;
Expand All @@ -94,7 +97,11 @@ export class Client implements Provider {

this.awareness = {
getLocalState: () => this._awarenessState,
getStates: () => new Map([[0, this._awarenessState!]]),
getStates: <T extends Record<string, unknown>>() => {
const baseState = this._awarenessState ?? {};
const extendedState = {...baseState} as UserState & T;
return new Map([[0, extendedState]]);
},
off: () => {
// TODO
},
Expand Down

0 comments on commit af24a59

Please sign in to comment.