Jump to content

Typescript vs Pure Javascript code


marius98
 Share

Recommended Posts

  • 1 month later...

As rich said, no right or wrong answer. I generally recommend pure vanilla JS for coding newbies, mainly for a couple reasons. The main reason being tutorials are abundant and second TypeScript is compiled to JavaScript. To me learning why Typescript was made, by using the language it was conjured for, is generally a good idea. Nonetheless I believe the tutorials alone are the main reason, if you need answers you'll find them quicker for vanilla JS than you will with Typescript. If you are already a knowledgeable programmer then really it's just a choice between having types or not. Happy coding!

Link to comment
Share on other sites

Typescript is more than just having access to types I would say.

Typescript was created because web apps became very complex and there was a need to make JS more scalable for big projects, using the oriented object programming (OOP) paradigm.

Used with something like Webpack to manage the import, Typescript feels like a very robust OOP solution. I very enjoy it; and I enjoy even more the fact that you can still have some of JS freedom.

 

Hence, I would say that for someone who don't know what is OOP, and who is beginning their journey in programming video games, Javascript is a good choice to start with small games.

When that someone feels more at ease with programming, they would learn about OOP and have a look at Typescript.

 

If you are familiar with Java, I would recommend checking Typescript.

Link to comment
Share on other sites

To put a counter argument, you can ignore OOP, its a huge red herring. ;)

Don't believe me, just do some research! ;)

He he, let the flame war begin!

Only joking, lets not do that, I'm just offering an alternative.

For me the premise of TS is flawed. A solid type system is something that would be beneficial in JS, but it doesn't require it, and trying to shoe-horn it on to a language that doesn't really work with it is a flaw.

Languages like Dart or Elm produce a JS output, but they're totally separate languages, they don't bolt a type system on to an existing language, they bake it right in to its own language.

I also totally agree with Rich though, try both, go with whichever one feels better right now for you. You can always change your mind later if you want.

Link to comment
Share on other sites

There are some that say Haxe is what javascript should have been, a swiftly typed speedy scripting language. Typescript for me has been a life saver as javascript has too many surprises that even if I try to study them and understand them all, I'm still prone to human errors of forgetfulness and clumsiness.  Overtly it's honestly just JSLint++ since all javascript code is valid typescript code and the super-set is non-intrusive.

The creator of node, vuejs, vscode, google, etc, advocate it's one of the best ways to manage large scaling javascript projects. If you're on vscode, you can add //@ts-check , and typescript will check your javascript and bug you about potential errors. If you find it saves you from lots of headaches, make the jump to typescript.

Link to comment
Share on other sites

You can show your TS-questions on Playground with mutifiles supporting. I think Plunker is one of the best: https://plnkr.co/edit/

You can use my example for understanding how to use require.js library: Drawing a few color rectangles with: WebGL 1.0, TypeScript

I think it is good and interesting to learn TS with some simple graphics. And I think it is good to learn GLSL for writing shaders and knowing how shaders works.

I suggest this very good book: WebGL Programming Guide: Interactive 3D Graphics Programming with WebGL (OpenGL)
And this one: Build your own 2D Game Engine and Create Great Web Games Using HTML5, JavaScript, and WebGL

You can rewrite examples from these books in TS. I do it now.

P.S. I want to find friends for learning TS and WebGL together. I need some practice in spoken English in Skype. Please, write me a private message.

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