You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use a plugin for the 1st time (having seen a recent reference to the bgio-effects plugin) ... it looks just like something I really want to use.
All was going fine until I got to the point of adding my game to the game server, and then the typescript compiler is throwing an error.
I have reduce this down to a small example:
import { EffectsCtxMixin } from 'bgio-effects';
import { EffectsPlugin } from 'bgio-effects/plugin';
import { Ctx, Game } from 'boardgame.io';
import { Server } from 'boardgame.io/server';
const EffectsConfig = {
effects: {
mediocreCards: {},
},
} as const;
interface GameState {
dummy: number;
}
export const MediocrityGame: Game<
GameState,
Ctx & EffectsCtxMixin<typeof EffectsConfig>
> = {
name: 'Mediocrity',
plugins: [EffectsPlugin(EffectsConfig)],
};
export const server = Server({
games: [MediocrityGame],
});
This causes the following error to be generated on the games: [MediocrityGame], line:
Type 'Game<GameState, Ctx & EffectsCtxMixin<{ readonly effects: { readonly mediocreCards: {}; }; }>, any>' is not assignable to type 'Game<any, Ctx, any>'.
Types of property 'setup' are incompatible.
Type '((ctx: Ctx & EffectsCtxMixin<{ readonly effects: { readonly mediocreCards: {}; }; }>, setupData?: any) => GameState) | undefined' is not assignable to type '((ctx: Ctx, setupData?: any) => any) | undefined'.
Type '(ctx: Ctx & EffectsCtxMixin<{ readonly effects: { readonly mediocreCards: {}; }; }>, setupData?: any) => GameState' is not assignable to type '(ctx: Ctx, setupData?: any) => any'.
Types of parameters 'ctx' and 'ctx' are incompatible.
Am I doing something wrong?
As I was looking at how plugins worked, I was wondering if the supplied PlayerPlugin should also provide a PlayerCtxMixin to allow it to be added to the default Ctx (otherwise I cannot see how to use the PlayerPlugin when using typescript?
The text was updated successfully, but these errors were encountered:
I am attempting to use a plugin for the 1st time (having seen a recent reference to the bgio-effects plugin) ... it looks just like something I really want to use.
All was going fine until I got to the point of adding my game to the game server, and then the typescript compiler is throwing an error.
I have reduce this down to a small example:
This causes the following error to be generated on the
games: [MediocrityGame],
line:Am I doing something wrong?
As I was looking at how plugins worked, I was wondering if the supplied
PlayerPlugin
should also provide aPlayerCtxMixin
to allow it to be added to the defaultCtx
(otherwise I cannot see how to use the PlayerPlugin when using typescript?The text was updated successfully, but these errors were encountered: