To using decorate, we can modifiy tsconfig.json: { "compilerOptions": { ... "experimentalDecorators": true, ... } } So for example we want to build a '@LogMethod' decorator, which arroding to the system logging level to decide whether…
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. tsconfig.json: { "compilerOptio…
Vue 2.2 introduced a simple dependency injection system, allowing you to use provide and inject in your component options. This lesson shows you how to use them using the @Inject and @Provide decorators in tandem! When you want to provide some servic…
If Typescript is the first language in which you've encountered generics, the concept can be quite difficult to understand. We skip the lecture in this lesson and dive straight into a real-world use-case that is guaranteed to help you understand the…
We usually think of types as something that can define a single layer of an object: with an interface we normally specify a list of a few properties and their respective types. If any one of those properties is another object we must refer again to i…
A literal type is a type that represents exactly one value, e.g. one specific string or number. You can combine literal types with union types to model a finite set of valid values for a variable. In this lesson, we explore the all kinds of literal t…
Some functions may have different return types depending on the types of the arguments with which they’re invoked. Using TypeScript’s function overloads, you can create an overload for each allowed combination of parameter and return types. This way,…
ypeScript 2.2 introduced the object, a type that represents any non-primitive type. It can be used to more accurately type methods such as Object.create. Don't confuse it with the Object type or {}, the empty object type, though! So one thing we need…