lance-gg / lance

Multiplayer game server based on Node.JS
https://lance-gg.github.io/
Apache License 2.0
1.59k stars 168 forks source link

typescript is possible ? #110

Closed athemsa closed 4 years ago

athemsa commented 5 years ago

Hi, me and my team have an ambitious project and we would like to know if it is possible to use typescript with lance-gg ?

We tried, but we have unrecognized methods or property ...

with your example Spaaace :

ERROR in F:\game prog\proj lance\src\common\SpaaaceGameEngine.ts(9,14) TS2339: Property 'physicsEngine' does not exist on type 'SpaaaceGameEngine'.

Property 'on' does not exist on type 'SpaaaceGameEngine'.

If you have an idea thanks for your help ^^'

namel commented 5 years ago

Lance is written in es6, and transpiled to es5 javascript. Take a look at package.json, the script "build" creates an es5 directory using the command babel src --out-dir es5. And the actual files imported by nodejs and browsers are those found in the es5 subdirectory.

This makes it complicated to use typescript. I'm not sure how you generated the typescript file, but I suspect you may need to add the missing properties and methods manually.

athemsa commented 5 years ago

Thank you for your answer, i will try to use es6 then ^^'

namel commented 4 years ago

Handled in #132