Jump to content

phaser.d.ts compilation problems in VS2013


larmjs
 Share

Recommended Posts

Hi!

 

I can create a new/blank Typescript project using the steps in https://phaser.io/tutorials/how-to-use-phaser-with-typescript  and it initially works fine ... but only for a while! The next day, or due to some other astrological event, VS2013 gets stuck refusing the compile the phaser.d.ts file, I get about 100+ errors and most are related to using the '|' sign in the declarations, example:

 

key: string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture;

 

VS complains "error TS1005: Build: ';' expected." (after the key:string)

 

The first error reported by VS I get at:

 

constructor(game: Phaser.Game, parent: Phaser.Sprite, name: string, frameData: Phaser.FrameData, frames: number[]|string[], frameRate?: number, loop?: boolean);

 

Where it complains about the '|' character between number[] and string[] (just prior to the frameRate) (error TS1005: Build: ',' expected.)

 

Sometimes it works if I create a new blank project and copy and paste the files into it again.. but that gets old pretty quick. Is there any way to fix this?

Link to comment
Share on other sites

  • 4 weeks later...

Looked into a bit more, apparantly my VS2013 shipped with typescript version 1.0!

 

Went to the visual studio gallery site and downloaded typescript 1.4, which fixed all the errors, phew!

 

I'm having the same issue, but installing typescript 1.4 (from the gallery) hasn't fixed it for me. I'm not sure how to uninstall typescript 1.0. It doesn't seem to be a plugin or an extension or a nuget package. If I don't include the phaser.d.ts file in the project, it won't compile my stuff that depends on phaser.js. I've tried turning the build action to "None" (as opposed to "Typescript Compile") for the phaser.d.ts file, but that didn't help either.

 

I'm using VS 2013 community edition. I had to install typescript into it. I downloaded it from somewhere and ran an install process, as I recall. I guess I installed the wrong thing.

Link to comment
Share on other sites

Hi, there is no need to uninstall old versions, but make sure your project is using the version you need. First look which SDKs you have installed at "c:\Program Files (x86)\Microsoft SDKs\TypeScript\" - each version has its own directory.

 

Then go into "your_project_name.csproj" file and look for <TypeScriptToolsVersion>1.5</TypeScriptToolsVersion> (I am using version 1.5 as it fixed some problems I had in previous versions). In case of incorrect version just overwrite it...

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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