Your Choice JavaScript News

TypeScript News Thursday, March 8 Typescript, Typescript config, Asynchronous callback hell & more…

TypeScript News TLDR / Table of Contents

  • TypeScript — JavaScript with superpowers –
    • TypeScript can — see that little red underline? That’s Typescript giving us a hint something is horribly gone wrong. You probably figured this one out (good job) — toUpperCase() is a type of String…
    • typescript, Typescript config, exactly Typescript, TypeScript world, Typescript shares
  • Episode 7: Five Things About TypeScript
    • Learn more at https://aka.ms/5things-azureTo watch more episodes go to https://aka.ms/FiveThingsPlaylist Learn five of the coolest features of TypeScript from Technical Fellow, Anders Hejlsberg. How c
    • asynchronous callback hell, editors better check, Control Flow Analysis, Anders Hejlsberg, coolest features
  • An Introduction to TypeScript: Static Typing for the Web —
    • Get started with this strongly-typed superset of JavaScript. Byron Houwens explains the benefits of types and interfaces in his introduction to TypeScript.
    • TypeScript, TypeScript website intro, awesome TypeScript loader, TypeScript files, TypeScript project
  • Lets fix it by stating we can only pass the type String as an argument to our nameToUpperCase() method.
  • Now instead of having to remember nameToUpperCase() only accepts a String, we can trust Typescript to remember it.
  • Notice TypeScript gets compiled to Javascript (its just a superset of Javascript, much like C++ toC)Thats the big-big argument why TypeScript and type checking is great.
  • Open your terminal and type the following: – We should end up with the Typescript config.
  • unorganized array vs tuple (organized array)If we dont follow the sorting index rules we issued for our tuple, Typescript will hint us we didnt go by the rules – The tuple expects the first value to be a numberbut its not in this case, its a string Indrek and thus…

Tags: typescript, Typescript config, exactly Typescript, TypeScript world, Typescript shares

  • Learn more at watch more episodes go to five of the coolest features of TypeScript from Technical Fellow, Anders Hejlsberg.
  • How can TypeScript help editors better check and improve our JavaScript?
  • How does TypeScript use Control Flow Analysis?
  • Learn these and why Anders is having so much fun creating compilers in this episode of Five Things!

Tags: asynchronous callback hell, editors better check, Control Flow Analysis, Anders Hejlsberg, coolest features

  • Heres an example from the TypeScript website intro tutorial (which you can find here): – – interface Person { – firstname: string; – lastname: string; – } – – function greeter(person : Person):string { – return Hello, + person.firstname + + person.lastname; – } – – let user = {firstname:…
  • This is where the interface feature comes in: – – interface Person { – firstname: string; – lastname: string; – } – – Interfaces are used in TypeScript to define the structure of objects (and only objects).
  • In our example, if we use this Person interface with a variable at any point in the program and it doesnt contain either a firstname or lastname, both of type string (our user object thankfully does), then the compiler will moan at us and we will be forced to mend…
  • Not only that, but having static typing means that an IDE or editor with support for TypeScript will be able to provide us with very good, very specific hinting and auto-completion so that we can develop code that is both faster and safer.
  • Further Reading – Conclusion – TypeScript is an interesting push toward improving on JavaScripts shortcomings by introducing a static typing system, complete with interfaces and type unions.

Tags: TypeScript, TypeScript website intro, awesome TypeScript loader, TypeScript files, TypeScript project