GameMonetize Posted April 22, 2014 Share Posted April 22, 2014 Hey guys! We started the port of Babylon.js to TypeScript. This will not change anything for you as babylon.js users. You can continue to contribute to Javascript version (I will do the port back to TS in this case). But I encourage you reading and learning TypeScript. As JS developers I sure you will love it I will write an article to explain this choice Edit: Here is the article=> http://blogs.msdn.com/b/eternalcoding/archive/2014/04/28/why-we-decided-to-move-from-plain-javascript-to-typescript-for-babylon-js.aspx Samuel Girardin 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted April 22, 2014 Share Posted April 22, 2014 I'm looking forward to that article. Especially for an opensource project, I personally would never go away from plain JS, because you are locking out a LOT of potential contributors. But lets wait for your article Samuel Girardin 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 22, 2014 Author Share Posted April 22, 2014 A lot of work for me in this case You can continue to contribute to Javascript version (I will do the port back to TS in this case) Btw Typescript is free, opensource, available on all platforms and all IDE, so I hope it won't be a too huge blocker Quote Link to comment Share on other sites More sharing options...
gwenael Posted April 23, 2014 Share Posted April 23, 2014 That sounds good. Will TypeScript version be the source code and the Javascript version an "export" of it? Yes if I have well understood.Just by curiosity, how will you handle that a variable can be a vector3 or a mesh (the target for the camera for example) in the TypeScript version? It won't always be easy to translate plain JS to TS except if you use "any" for those variables but then the type will be missing in TypeScript Quote Link to comment Share on other sites More sharing options...
Chris Posted April 23, 2014 Share Posted April 23, 2014 @Deltakosh: Talk to rich about using Typescript for an OS project. He started Phaser in Typescript, I thought it was not the best idea. In the end he had so many problems that he invested days to roll everything back to vanilla JS. Quote Link to comment Share on other sites More sharing options...
Ezelia Posted April 23, 2014 Share Posted April 23, 2014 I actually work with TS in big projects it's not allways easy but thing are becomming a lot better than before ...since 0.9.5 we had almost no problem with the language or compiler. now that TypeScript is in stable 1.0 version we also have the assurance of no more breaking change .The only real problem IMO for OpenSource projects is contributions ... I remember when Rich switched back to JS, that time I agree there was so many breaking changes in TypeScript compiler when they moved from 0.8.x to 0.9.x ... and so many issues with the compiler : from performance issues to buggy generated JS ... but everything was fixed in newer version. Quote Link to comment Share on other sites More sharing options...
davrous Posted April 23, 2014 Share Posted April 23, 2014 Hi, TypeScript is generating clean JS. You'll be still able to contribute to fix code by sending JS. We will take care of converting changes to TS if you're not confortable with that, even if we would love that you're doing it in TS directly. I've used TS some months ago in 0.8 and 0.9. I think that 1.0 is now perfectly stable and will be integrated very well in our current babylon.js team dev chains (VS2013 & Visual Studio Online). That's why we're thinking that it's the right moment for switching. We have already identified some bugs in our code thanks to that. I'm still a bit stressed by community contributions & feedbacks but I don't think it would be a problem. As I've told you, nothing prevents you to fix or submit a feature in plain JS. TypeScript can work smoothly with classic JS. Bye, David Samuel Girardin, gwenael and Xanmia 3 Quote Link to comment Share on other sites More sharing options...
gamestudiohx Posted April 23, 2014 Share Posted April 23, 2014 You should go with Haxe. It also generates clean JS and brings Babylon to more platforms. Quote Link to comment Share on other sites More sharing options...
SideraX Posted April 24, 2014 Share Posted April 24, 2014 Hi, Can you add the _references.ts in the git repository ? It will be usefull for the command line compilation, and I will able to add this task for gulp :gulp.task('typescript', function() { return gulp.src(['../../Babylon/**/*.ts']) .pipe(typescript({ out: 'Babylon.js', declaration: true, target: 'ES5' })) .pipe(gulp.dest('build/'));}); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 24, 2014 Author Share Posted April 24, 2014 Where should I find this file? Quote Link to comment Share on other sites More sharing options...
SideraX Posted April 24, 2014 Share Posted April 24, 2014 http://blogs.msdn.com/b/typescript/archive/2013/12/05/announcing-typescript-0-9-5.aspx My understanding is that Visual Studio manage references between ts files implicitly, however "tsc" need all that explicitly (I think) BUT I just test it without it and the compilation worked ... so just forget everything I said ^^ Edit : Well no, tsc does need the references to compile files in the right order. It's possible to maintain a _references.ts with all the source files referenced in the right order inside ? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 24, 2014 Author Share Posted April 24, 2014 Ok well I will do that Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 28, 2014 Author Share Posted April 28, 2014 Article: http://blogs.msdn.com/b/eternalcoding/archive/2014/04/28/why-we-decided-to-move-from-plain-javascript-to-typescript-for-babylon-js.aspx gwenael, Wingnut and Dad72 3 Quote Link to comment Share on other sites More sharing options...
demonixis Posted April 29, 2014 Share Posted April 29, 2014 I think it's a good ide. The static compilation is a really nice feature. JavaScript is different and has its limits for webapps. With TypeScript, Babylon.js will be more scalable and maintainable and it's a very good thing. The next step is to create good resources for developers to learn them the benefits of TypeScript programming. I'll try to write some tutorials (in French because there are already enough English writter) for TypeScript but I need to learn it correctly before that. Dad72 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 29, 2014 Share Posted April 29, 2014 It is a good idea to the tutorial in french. Thank you Quote Link to comment Share on other sites More sharing options...
Marco Lebdech Posted May 26, 2014 Share Posted May 26, 2014 Hi, I recently started to use Babylon.js with our will-be-really-complex-in-the-future project written in TypeScript with Angular.js. I know that you are working on TypeScript version of Babylon, but I found nowhere (maybe I just didnt search enough) how to use new version of Babylon in project with TypeScript. I tried to use 1.11, but as I startedtrying to implement Shaders, there are no TypeScript definitions for ShaderMaterial. Is there any unofficial version of Babylon.d.ts, or i should edit that file in order to use 1.12 version of Babylon.js? Thanks,Marek Quote Link to comment Share on other sites More sharing options...
davrous Posted May 26, 2014 Share Posted May 26, 2014 We haven't finished yet to port it to TS. We've done 90% of the job. It's currently only in our private source code repository. 1.12 has been created using our private TS build. It should be 100% TS completed by 2 weeks. David Samuel Girardin 1 Quote Link to comment Share on other sites More sharing options...
SideraX Posted May 26, 2014 Share Posted May 26, 2014 Hi. The merge request I pushed today was merged.So you can use gulp to build babylon from the ts files and generate the babylon.d.ts : https://github.com/BabylonJS/Babylon.js/tree/master/Tools/Gulp Note that as the ts port is not yet completed, some declaration can be missing. Quote Link to comment Share on other sites More sharing options...
Marco Lebdech Posted May 27, 2014 Share Posted May 27, 2014 Thanks for your reply davrous and SideraX, I am glad to hear that port will be completed that soon :-) (I am shaking in impatience :-D). I will try to build babylon today to get *.d.ts and see if it will works for some time as i need Quote Link to comment Share on other sites More sharing options...
binyan Posted May 30, 2014 Share Posted May 30, 2014 ThisskyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("skybox/skybox", scene);Doesn't work with typescript. The error is "Cannot convert BABYLON.CubeTexture to BABYLON.Texture. Type BABYLON.CubeTexture is missing property uOffset from type BABYLON.Texture" Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 31, 2014 Author Share Posted May 31, 2014 Yes I will fix that point Quote Link to comment Share on other sites More sharing options...
Alvaro Posted September 19, 2015 Share Posted September 19, 2015 Hi, I am using typescript with babylon js. It is easy to find babylon.js in nuget but not so easy to find the right typing files for babylon. I am using "babylon.2.0.d.ts" but it does not contain everything. What is the right way to develop using typescript with babylon? Should I use a babylon.ts file that integrate everything? Quote Link to comment Share on other sites More sharing options...
ChrisR Posted September 19, 2015 Share Posted September 19, 2015 I personally grab the src files off of the github. They have a gulp file on there. Just run the gulp file and it will compile a new d.ts file for you. Making it up to date with everything. Quote Link to comment Share on other sites More sharing options...
adam Posted September 19, 2015 Share Posted September 19, 2015 https://github.com/BabylonJS/Babylon.js/tree/master/dist https://github.com/BabylonJS/Babylon.js/tree/master/dist/preview%20release%20-%20beta Quote Link to comment Share on other sites More sharing options...
Alvaro Posted September 20, 2015 Share Posted September 20, 2015 Thank you @Adam! That typing file includes references to "AudioContext", "AudioNode", etc...But I don't have that and is failing at compilation time. Am I force to have that javascript framework? Where can I find it if that is the case Thank you again! @ChrisR, I have never use gulp, but will take a look. anyway, for now, If I can get the compiled version, it is enough for me. Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.