colyseus / colyseus-examples

Examples for learning how Colyseus works
https://examples.colyseus.dev/
MIT License
177 stars 90 forks source link

Type 'Server' has no properties in common with type 'Partial<MonitorOptions>'. #25

Closed JSXS closed 4 years ago

JSXS commented 4 years ago

I've been unable to run this example by following the instructions in the readme.

git clone https://github.com/colyseus/colyseus-examples.git
cd colyseus-examples
npm install
npm start

I get the error:

TSError: ⨯ Unable to compile TypeScript:
index.ts:45:30 - error TS2559: Type 'Server' has no properties in common with type 'Partial<MonitorOptions>'.

45 app.use('/colyseus', monitor(gameServer));

In index.ts, the following imports didn't have type definitions (until I installed the @types/* packages for each of them, but that didn't help.):

import express from 'express';
import serveIndex from 'serve-index';
import cors from 'cors';

Note: running the install, i got the warning @colyseus/monitor@0.11.17 requires a peer of colyseus@^0.11.0 but none is installed. You must install peer dependencies yourself., So i changed the version in package.json from ^0.12.0 to 0.11.0 and re-installed it, but that didn't help either.

endel commented 4 years ago

Hi @JSXS, thanks for letting me know, @colyseus/monitor have been updated recently, and now the argument is different: https://github.com/colyseus/colyseus-examples/commit/be5e80994f50410f480d4861a483fb85b7fbe2fc

Let me know if you have any other problems