Import polyfill using dynamic imports in TypeScript

TypeScript 2.4 has introduced Dynamic imports. In a previous, we have seen how to use static imports in TypeScript. Static import allow to use a module. You import all the modules needed at the beginning of the TypeScript file and use them later: import { ZipCodeValidator } from "./ZipCodeValidator"; const myValidator = new ZipCodeValidator(); Dynamic imports on the other hand are not declared at the… [read more]

How to migrate from JavaScript to TypeScript?

After the previous posts about TypeScript, I'm sure you'd like to migrate your application from JavaScript to TypeScript. If you haven't read them yet, take a few minutes: Still not using TypeScript? Detect common JavaScript errors with TypeScript The migration from JavaScript to TypeScript is not a very complicated process. But there are some steps to follow to achieve it correctly without spending too… [read more]

Live unit testing in Visual Studio 2017 Enterprise

Unit tests allow to validate the behavior of your code. When you write code, you want to get feedback from your tests as soon as possible. It is where the new feature of Visual Studio 2017 takes place. The live unit testing feature runs test in background as soon as you save a file and display the result directly in the code editor. Of course you don't want to run thousands of tests in background every… [read more]

Aspect Oriented Programming in TypeScript

Aspect Oriented Programming (AOP) addresses the problem of cross-cutting concerns, which would be any kind of code that is repeated in different methods and can't normally be completely refactored into its own module, like with logging, caching or validation. These system services are commonly referred to as cross-cutting concerns because they tend to cut across multiple components in a system. AOP allows… [read more]

Filter Application Insights events in ASP.NET Core

Application Insights ingests lots of data: requests, traces, events, metrics, etc. If your web site has lots of users, the amount of data can be huge. This mean you pay for this data. While Application Insights is cheap, you may want to reduce the bill. One way is to sample the data. In short, you send only xx% of the events. This is the simplest solution. The other solution is to filter low value events… [read more]