Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
Reducer,
State,
Store,
Ctx,
} from '../types';

type ClientAction = ActionShape.Reset | ActionShape.Sync | ActionShape.Update;
Expand Down Expand Up @@ -86,8 +87,8 @@ export const createEventDispatchers = createDispatchers.bind(null, 'gameEvent');
// Creates a set of dispatchers to dispatch actions to plugins.
export const createPluginDispatchers = createDispatchers.bind(null, 'plugin');

export interface ClientOpts<G extends any = any> {
game: Game<G>;
export interface ClientOpts<G extends any = any, CtxWithPlugins extends Ctx = Ctx> {
game: Game<G, CtxWithPlugins>;
debug?: DebugOpt | boolean;
numPlayers?: number;
multiplayer?: (opts: TransportOpts) => Transport;
Expand Down
9 changes: 7 additions & 2 deletions src/client/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Client as RawClient, ClientOpts, _ClientImpl } from './client';
import { State } from '../types';
import { State, Ctx } from '../types';

type WrappedBoardDelegates = 'matchID' | 'playerID' | 'credentials';

Expand All @@ -18,7 +18,10 @@ export type WrappedBoardProps = Pick<
WrappedBoardDelegates | 'debug'
>;

export type BoardProps<G extends any = any> = State<G> &
export type BoardProps<
G extends any = any,
CtxWithPlugins extends Ctx = Ctx
> = State<G, CtxWithPlugins> &
Pick<
_ClientImpl<G>,
| 'log'
Expand All @@ -30,9 +33,11 @@ export type BoardProps<G extends any = any> = State<G> &
| 'playerID'
| 'matchID'
| 'matchData'
| 'credentials'
> & {
isActive: boolean;
isMultiplayer: boolean;
isConnected: boolean;
};

type ReactClientOpts<
Expand Down