pixi-tiledmap icon indicating copy to clipboard operation
pixi-tiledmap copied to clipboard

Error ts2306 : index.d.ts is not a module

Open qmidy opened this issue 5 years ago • 1 comments

Hi,

Thx for the development of pixi-tiledmap... But i'm not able of using it.

Here is my simple code :

_import { Component, OnInit, ElementRef } from '@angular/core'; import { Map } from '../../model/Map.model'; import { MapService } from '../../services/map/map.service'; import { GameService } from '../../services/game/game.service'; import { Application } from 'pixi.js'; import { TiledMap } from 'pixi-tiledmap';

@Component({ selector: 'app-world', templateUrl: './world.component.html', styleUrls: ['./world.component.css'] }) export class WorldComponent implements OnInit {

private map: Map; public app: any;

constructor(private gameService: GameService, private mapService: MapService, private elementRef: ElementRef) { const app = new Application({ width: 800, height: 600 }); this.app = app; this.elementRef.nativeElement.appendChild(app.view);

app.loader
  .add('assets/maps/map1.tmx')
  .load(function () {
    app.renderer.render(new TiledMap('assets/maps/map1.tmx'));
  });

}

ngOnInit() {

this.gameService.getGameOnEvent().subscribe(game => {
  this.map = game.Map;
});

}

}_

And i got a compilation problem :

error TS2306 : File 'pixi-tiledmap.d.ts' is not a module

And in the console :

core.js:7187 ERROR TypeError: pixi_tiledmap__WEBPACK_IMPORTED_MODULE_4__.TiledMap is not a constructor

I guess I'm doing something wrong but can't know what :(

Would you please help me ?

Quentin

qmidy avatar Jul 18 '19 13:07 qmidy

I have exact the same issue. @qmidy, did you solve it?

justclimber avatar Mar 05 '20 14:03 justclimber