Is Excalibur typescript 2.0 compatible?
See original GitHub issueSorry if this is wrong place to ask questions, but forum seems deserted.
My problem is that I want to use Excalibur with TypeScript and webpack. I was able to setup webpack and ts compiler so everything works, including loading 3rd-party libs installed with npm (e.g. lodash). It looks like this: https://github.com/hogart/excalibur-test. But at the moment I add import {ex} from 'excalibur';
I get an error TS2306: File '<path-to-project>/node_modules/excalibur/dist/excalibur.d.ts' is not a module.
.
I looked at how lodash .d.ts is written and manually added following to dist/excalibur.d.ts
:
export = ex;
export as namespace ex;
This did the trick, ex.Engine
was properly imported and initialized, but this can’t be called a solution.
Since I’m pretty new to TS, I’m bit lost. Am I missing something in my tsconfig.json
? Can this issue be fixed with some custom .d.ts. which re-exports ex
namespace? Should I downgrade to TypeScript 1.8, since this version used for developing Excalibur?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
Ok, I’ll watch that issue for news. Thanks for support and great lib:)
Funny thing that at first I tried Phaser and was disappointed that it requires monkey-patching
.d.ts
in order to work with typescript. Anyway, Excalibur is better because it doesn’t require ugly crutches to work with webpack and provided typings obviously superior.Appreciate it, we still have some work to do. Maybe tonight I will write up a guide on using Ex with module loaders and add it to the docs. @eonarheim did a similar monkey patch for https://github.com/eonarheim/TypeState/pull/13 to support module loading with TS, we could do it the same way.