Improve your type workflow with control flow analysis

Keyboard Shortcuts

TypeScript 2 introduced another useful feature, the ability to analyze type at any given time in your application. This allows to define multiple options for your type and then assign values of different type throughout your application. In this video we’

- [Instructor] TypeScript two introduced…another useful feature,…the ability to analyze type…at any given time in your application.…This allows to define multiple options…for your type and then assign values…of different type throughout your application.…In this video, we'll explore what is control flow analysis…and the added benefit from this feature.…So, let me demonstrate.…So the first thing we'll do…we'll create a variable call my control flow.…Like so.…

And then we'll assign it a type of string or number.…So if you've worked with TypeScript before…or any programming languages,…this is pretty much how you do a or…and then what we'll do,…we'll assign my control flow a string.…Hello, I'm a string.…Then we'll make sure we log this.…A shortcut to type control log is log, like so,…and then you can do my control flow…and then what we'll do,…we'll assign a different type to my control flow…and assign it a number,…so basically if you look at the flow of your variable here,…you define it and the types are either string or number,…

Resume Transcript Auto-Scroll

Author

Released

4/10/2017

TypeScript is a newer Microsoft language built on JavaScript that is finding wide adoption in the Microsoft, Google, and Angular communities. Like many things JavaScript these days, TypeScript is changing rapidly as it grows. This course introduces the latest enhancements of this rapidly evolving language including kinds of types, approaches for interacting with types, and more.