Jump to content

TypeScript


Deltakosh
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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/'));});
Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

This

skyboxMaterial.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"

Link to comment
Share on other sites

  • 1 year later...

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? 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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