Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

[TypeScript compile option question] Command-line compiling implies errors in Phaser


PROGRAM_IX
 Share

Recommended Posts

I'm clearly missing something.

 

I pulled down from GitHub (just now, again, to make sure) and am running almost verbatim the rect vs. rect test from the test suite. Or rather, I'm trying. I installed Node.js and used npm to get the tsc compiler, which seemed fine. But then I tried to actually compile something and I got screenful after screenful of errors.

 

.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(140,21): The property 'scrollFactor' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(140,52): The property 'scrollFactor' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(142,55): The property 'scrollFactor' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(143,55): The property 'scrollFactor' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(147,21): The property 'angle' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(149,21): The property '_game' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(150,21): The property '_game' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(152,25): The property 'angle' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(154,25): The property '_game' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(154,57): The property 'angle' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(162,22): The property '_game' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(175,48): The property '_game' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(179,48): The property '_game' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(185,21): The property '_game' does not exist on value of type 'ScrollZone'.../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/phaser/Phaser/gameobjects/ScrollZone.ts(16,4): Base type 'any' lacks an implementation..../programming/html5/phaser/ld48/test.ts(5,28): The property 'Game' does not exist on value of type 'Phaser'.../programming/html5/phaser/ld48/test.ts(15,13): The property 'velocity' does not exist on value of type 'Phaser.GeomSprite'

 

(That's the last few lines, but it seems to have a problem with just about every Phaser class.) It just goes on like that. 

 

Here's my directory structure:

 

 

.../programming/html5/phaser:    phaser/ [Phaser library]        Phaser/        Docs/    ld48/ [site of game code if it ever works]        test.ts [rect vs. rect from test suite, with one change (see below)] 

 

 

The only change I've made to the test.ts file is this: 

 

 

/// <reference path="../phaser/Phaser/Game.ts" /> 

And here's how I compile:

 

 

 

tsc test.ts 

 

 

 

That should work, right? It's clearly *finding* the Phaser files, but what is the deal with these errors?

 

Any help greatly appreciated. Falling at the first hurdle is never fun.

 
Link to comment
Share on other sites

Thanks, I will! I was looking at those options earlier, but seeing the default is ES3 I thought that ES5 would only *increase* the possibility for errors.

---

Oh wow, that was dramatic. The errors have now been reduced to this: 

 

 

.../programming/html5/phaser/phaser/Phaser/system/Device.ts(384,49): The property '$1' does not exist on value of type '{ (pattern: string,flags?: string): RegExp; new(pattern: string,flags?: string): RegExp; }' 

 

Link to comment
Share on other sites

Phew.. I saw your tweet about this earlier while at the park with my kids but didn't have time to look at it until now, so thank you very much Hsaka :)

 

Yeah it needs ES5 and nolib as you've found out! Let me add that to the readme file now :)

Don't worry about it, I wouldn't have tweeted you at all but I had tried a couple of things with no success and wasn't sure just how silly a mistake I was making.

 

--nolib didn't actually fix it, though! The ES5 reduced it to one error, but --nolib freaked it out all over again. I did have to go into the code of Device.ts and comment out a line. So --nolib wasn't the solution in my case, anyway. I probably just did that wrong too. XD

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...