Jump to content

Would any of you care if I dropped TypeScript support from Phaser?


rich
 Share

Recommended Posts

This is a serious question. I have wasted an incredible amount of time due to my decision to use TypeScript, and the problems are still on-going. So I'm curious to know how much it would affect any of you? Do you actually benefit from it supporting TypeScript, or would you be happy enough just using JavaScript?

 

Update: 10th September. After a lot of thought and based on the stack of feedback on this forum I dropped building Phaser in TypeScript and started a rebuild in pure JavaScript. Progress has been fantastic and you can follow it all on the March Towards 1.0 thread in this forum.

Link to comment
Share on other sites

I know im new user but having typecript support was what made my mind to even try html5 development and go with phaser.

 

On the other hand as far as I see problems go often with new releases of typescript, but 0.83 is stable enough to not care about new typescript versions until they hit 1.0 mark and not break backwards compatibility.

 

Plain javascript is just terrible, awfull, horrifying and impossible to make anything worthwhile with. Its even going to be dropped from unity 3d in favour of c# so that says something.

Link to comment
Share on other sites

I tested TypeScript only because of Phaser - but I did not like it at all (although the basic concept of the language itself is sweet).

 

So, I would not mind at all about Phaser being plain javascript only! 

 

However, I could imagine that this would be a huge step for you. Is the generated javascript code by typescript something you could continue to work with - or do you have to re-write parts of it ?

Link to comment
Share on other sites

I have 2 projects near end made with Phaser TS. But to be honest I will probably port them to pure JS or CoffeeScript becouse TS starts to annoy me with its bugs and hacks you have to do to make it work (offtop: nodejs nad TS isn't a good couple  :angry:  )

Link to comment
Share on other sites

I would mind a great deal if TS support was dropped from Phaser. I've made a few games with Phaser and had no problems with TS 0.8.3 so far. TS allows for so much more structure and organization and allows me to rapidly develop new games.

Link to comment
Share on other sites

rich - but what does it mean "to drop support for typescript"? You or someone else can still provide declaration files, and it will work like a charm with type script. Existing users may probably have to make some changes, but they should be reasonably small.

 

I am using CreateJS for my games. Declarations from definitelytyped work like a charm. Well, I had to change them every once in a while, but it was never a showstopper. Same about libs like jquery, node js bindings, etc.

 

As for using plan JS for open library, I bet this is better option. Despite all my love for Type Script, there are other language choices (plain JS, coffee script). Making library independent from them is good of course. And I agree that evolving nature of type script makes it moving target to maintain something for a long term. 

Link to comment
Share on other sites

Just to say that you never, ever HAD to use TypeScript in order to use Phaser. It has always been perfectly usable from both plain JavaScript and TS.

 

What I'm questioning is the decision to carry on building the framework using TS first. I would definitely still provide a definitions file for TS, so it won't make any real difference unless you were interested in extending the core framework.

Link to comment
Share on other sites

Just to say that you never, ever HAD to use TypeScript in order to use Phaser. It has always been perfectly usable from both plain JavaScript and TS.

 

What I'm questioning is the decision to carry on building the framework using TS first. I would definitely still provide a definitions file for TS, so it won't make any real difference unless you were interested in extending the core framework.

 

Then totally go with it, as constantly adjusting library to new version of typescript that breaks all your work - is pretty much harsh development cycle, and certainly not healthy.

Link to comment
Share on other sites

For those asking on twitter: Here is why I'm considering dropping building it in TypeScript:

 

1) It's bugged to hell. Sorry, but it just really is. 0.8.3 was the last stable version they released and even that is relatively easy to break, or get your Visual Studio configs in a mess with.

 

2) It makes integrating other 3rd party libraries considerably more work, as you have to either painstakingly create a lib.d.ts for them or convert them to TypeScript.

 

3) The generated JavaScript is ok and mercifully readable, but does contain quite a lot of redundant calls and hooks. It's also not very intelligent in the way it compiles. If you don't use say physics or particles it still compiles the whole frigging lot into your game anyway. I'd quite like a way to avoid this, but it does make the barrier to entry higher as well. Needs more thought (and no, requireJS isn't the answer, again the whole 'barrier' is there with it).

 

4) I love getters/setters, they make coding so much cleaner - but they also make it ES5 only, which means it dies horribly on IE8 or less. As Phaser is canvas only this doesn't matter too much (as canvas is IE9+) but part of me wishes it did work backwards as well. Maybe just wishful thinking though. The thought of not being able to do:

 

sprite.x = 100

 

.. and have x be a function that can update all kinds of properties in one sweep is really upsetting to me :)

 

5) Currently an un-proven concern; but I'm worried about the impact it may have using TS when trying to integrate with say Firefox OS or CocoonJS.

 

So anyway... these are my thoughts on it at the moment. Feel free to shoot them down / add to them.

Link to comment
Share on other sites

Plain javascript is just terrible, awfull, horrifying and impossible to make anything worthwhile with.

 

Please try to refrain from comments like this that have no basis in reality, this statement was barely true 15 years ago and is just false today.

 

 

 

@rich, I would be much more likely to contribute to Phaser if it was in JS instead of TypeScript, and I doubt I am the only one who shares that opinion.

Link to comment
Share on other sites

@rich, I would be much more likely to contribute to Phaser if it was in JS instead of TypeScript, and I doubt I am the only one who shares that opinion.

 

This is a very good point. Although I've been pleased with contributions so far I'm sure that would accelerate them.

Link to comment
Share on other sites

Then totally go with it, as constantly adjusting library to new version of typescript that breaks all your work - is pretty much harsh development cycle, and certainly not healthy.

I'd have to agree with this. As long as a definition file is included with the framework we can get the best of both worlds.

Link to comment
Share on other sites

If you can take the generated code and work with it, then you have little to lose. You main gain/lose some contributors. Once Typescript hits version 1.0 or whatever it needs to hit to get stable then you can start to gradually use it again, assuming the benefits are there for you/the project.

Link to comment
Share on other sites

I really don't see how 5 could be of an issue, given that it outputs normal JS. Can you give an example on "quite a lot of redundant calls and hooks"? Apart from constructor/inhertiance stuff, and arrow functions "this" propagation I haven't seen any big differences yet.

 

Also, Rich, just to make sure all pros/cons are discussed, can I suggest you give your list of reasons why you embraced TS in the first place? 

 

This is why I am building my next game in TS and like it so far (you are guilty with that, btw :) ):
0. If I don't like it, I can easily switch to plain JS. :) I can also give away just JS files to my customers, if they need it for API implementation or customization

1. Easier to write R8/Nitro friendly statically typed code. In the heat of the battle, it is easy to add property in wrong order. Or add hacky extra property and forget about it. 

2. Syntax sugar for classes, modules, interfaces, arrow functions. They are very common in my games, long raw JS syntax lowers my productivity.

3. Reasonably good compile-time dependencies between multiple JS files

 

However, I guess for library 1 is not so much of an issue, as it should be peer-reviewed and not made in the heat of the battle. 2 is subjective: JS people are less likely to contribute to TS, but TS/CoffeeScript guys are get used to the fact that libraries out there is in plain JS. Plus good IDE/editor will help with 2 a lot. And 3 is not unique to TS, for a library something else can be easily introduced.

Link to comment
Share on other sites

I think I would still build my games in TS. I'm just finding using it to build a library of any reasonable size such a pain in the ass. It was fine for the first few versions but has grown ever more complex. I'm having to write php scripts to rebuild my Visual Studio config files because VS gets in such a mess. I shouldn't have to be doing this! Also I'd love to swap back to use Sublime as it's a much better editor :)

 

However there are downsides too: I love the way you get all the power of ES5 but with 'clean' code. I love the static type compile checks, it catches all those "typo" and "parameter order" errors quickly (WHEN the compiler sodding works that is). Phaser is a pretty big library now, with a lot of dependencies and deep internal hooks - being able to dive into those via F12 in VS is a God-send. I won't get that sort of feature in Sublime and as much as I like WebStorms features, the interface is just so clunky I feel like I code at a snails pace using it.

 

I do wonder if perhaps the solution is to swap back to JS. I mean all the code is written, it won't take much to make that transition, and then use TS for my unit tests! Maybe I'll get the best of both worlds then. Or maybe I should just learn to use the Closure compiler properly :)

Link to comment
Share on other sites

I'm able to use TS 0.9.x with IntelliJ idea, no issue. Also why did you chose TypeScript over Haxe? Haxe isn't new as TypeScript, it should be more robust (however migrating project from Haxe 2.x to Haxe 3.x is a pain in the ass due to all the other libs you may use, I won't imagine if there were an AS4, finally thanks Adobe... but that's an other story).

Link to comment
Share on other sites

I'm able to use TS 0.9.x with IntelliJ idea, no issue. 

 

Well - you can edit things for sure and plug in the new compiler. But unless you are on EAP, only TS 0.8.3 syntax is supported in the current version (issue web-8250). This includes syntax highlight, underlining errors and many other features. You will have Idea complaining on bool vs boolean (#1 showstopper), on interfaces that extend classes, on new module import syntax. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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