Using Assertion to Convert Types in TypeScript
lessonDuration 2m 9s
Sometimes the compiler needs help figuring out a type. In this lesson we learn how to help out the compiler with Typescript type assertion.
Browse
Find courses, lessons, articles, talks, and podcasts.
389 results for "typescript"
Showing 97–120 · Page 5 of 17
lessonDuration 2m 9s
Sometimes the compiler needs help figuring out a type. In this lesson we learn how to help out the compiler with Typescript type assertion.
lessonDuration 5m 1s
Sometimes we want our function arguments to be able to accept more than 1 type; e.g. a string or an array. This lesson will show us how to assign more than 1 type to a variable with Typescript union types and type aliases.
course
Learn some of the new features of TypeScript 3.7
lessonDuration 47s
Storybook is a UI component development environment for React, Vue, and Angular. With that, you can develop UI components without running your app. In this short video I show how to set up the `react-docgen-typescript-webpack-plugin`, a neat plugin that leverages the types you are -already- writing for Typescript to autogenerate documentation.
lessonDuration 1m 59s
In this course, we will learn how to set up all the necessary infrastructure to build a Design System of reusable React components, with state of the art developer experience enabled by Typescript and Storybook. A design system is a series of components that can be reused in different combinations. Design systems allow you to manage design at scale. Head to designsystemsrepo.com and you can see Design Systems used by some of the biggest companies and strongest brands from Priceline, Apple, IBM, Wework, Github, and even the US Government. Design Systems can be a significant productivity multiplier in any medium-to-large project or company because you can document your components as you develop them, ensure a consistent look and feel throughout all your screens, and have a seamless workflow between designers and developers.
lessonDuration 3m 23s
Decorators are a feature of TypeScript that are becoming more and more common in many major libraries. This lesson walks you through what decorators are and how to create your own.
lessonDuration 3m 38s
One of the most confusing parts of getting started with TypeScript is figuring out how to use all the libraries that you know and love from JavaScript. This lesson walks you through including Lodash in your project, installing Lodash definition files, and then properly loading Lodash with SystemJS.
lessonDuration 3m 14s
This lesson covers using your first TypeScript Interface and what happens to the Interface when it is compiled down to JavaScript.
lessonDuration 1m 48s
Files globs will be available in TypeScript 2.0, so in the meantime, we need to use "exclude" and "rootDir" to configure which files to load. This lesson shows how to switch from "files" to "exclude".
lessonDuration 5m
TypeScript outputs JavaScript, but what are you supposed to do with it? This lesson shows how to take the output and use SystemJS as the module loader so that you can use the files in your browser.
lessonDuration 5m 51s
TypeScript definition files can be an extremely confusing topic to tackle due to the sheer variety and of features and libraries they need to cover. This lesson helps you understand definition files, how they're used, and where to find them based on many different scenarios.
lessonDuration 5m 59s
TypeScript allows you to emit decorator metadata which enables more powerful features through reflection. This lesson show you how decorators and reflection fit together and how to configure your own decorators to use reflection.
lessonDuration 4m 44s
Using TypeScript when installing packages from npm often requires you to install related definition files. This lesson shows you how to use typings to install es6-shim then how to configure SystemJS to load from node_modules.
lessonDuration 1m 31s
As long as you have a properly configured .tsconfig, most tooling can just run tsc behind the scenes to build your project. This lesson shows how WebStorm includes a nice interface for reporting and navigating to the errors and will continuously run your TypeScript build for you.
lessonDuration 58s
TypeScript will always compile even if there are ridiculous errors in your project. This lesson shows how to configure your .tsconfig with "noEmitOnError" so that no files are output if tsc reports an error.
lessonDuration 2m 41s
TypeScript allows you to generate definition files for your own libraries. This lesson shows you how to organize your project and generate the definition files so that others projects can use your library with TypeScript.
lessonDuration 52s
This lesson walks you through creating your first .tsconfig configuration file which will tell the TypeScript compiler how to treat your .ts files.
lessonDuration 1m 59s
This lesson shows you how to install TypeScript and run the TypeScript compiler against a `.ts` file from the command line.
lessonDuration 2m 10s
In this course we will look at advanced features of TypeScript and how they can be leveraged in our apps using applicable patterns and examples. In the videos that follow, you will learn how to write cleaner and more readable code that is more type safe, and you will gain access to a lot more options for creating strong & maintainable designs when building classes and services.
lessonDuration 1m 4sFree
This video shows how to create a React application with TypeScript using the new TypeScript support in create-react-app 2.1.0. In this lesson, we'll create a React project with create-react-app, rename some files, and see how create-react-app detects TypeScript in our project and automatically generates a .tsconfig file for us.
lessonDuration 5m 50s
Decorators are a powerful feature of TypeScript that allow for efficient and readable abstractions when used correctly. In this lesson we will look at how we can use decorators to initialize properties of a class to promises that will make GET requests to certain URLs. We will also look at chaining multiple decorators to create powerful and versatile abstractions.
lessonDuration 4m 17s
The "any" type can be very useful, especially when adding types to an existing JavaScript codebase, but it can also lead to lots of runtime errors, as it provides no type-checking. The "unknown" type on the other hand, restricts developer from calling anything on it or assigning to any other type. The only way to use "unknown" variables is to apply logic flow type narrowing or casting, as that's the only way TypeScript can trust that it's dealing with a correct type. The "unknown" type is useful when building services or APIs that can return data of an unknown shape, so we might want to stop other developers from using it in potentially dangerous ways until it's been narrowed down to a specific type.
lessonDuration 6m 43s
Traversing items of custom data structures, like trees or linked lists, require knowledge of how that data structure is built. That can lead to problems, as faulty iteration strategies might not visit all the items, or they might not know when they've finished visiting all of them. In this lesson, we're going to look at how TypeScript supports us in building custom ES6 iterators that can be then used by a simple "for..of" loop to ensure we provide an easy to use and reliable API for other developers to traverse our data structures.
lessonDuration 3m 16s
Sometimes we might want to make a function more generic by having it accept a union of different types as an argument. Using the JavaScript “in” operator, we can test for the presence of different properties on the argument object, and TypeScript will automatically infer the exact type of our object in that block. It does this by looking at all the possible types in the union and then keeping only the ones that have that specific property defined.