November 2018
Beginner
502 pages
10h 22m
English
By default, TypeScript generated JavaScript code that executes in what is called the global scope. This means code from one file is automatically available in another file. This in turn means that the functions we implement can overwrite functions in other files if the names are the same, which can cause our applications to break.
Let's look at an example in Visual Studio Code:
interface Product { name: string; unitPrice: number;}
class OrderDetail { product: Product; quantity: number; getTotal(discount: number): number { const priceWithoutDiscount ...Read now
Unlock full access