Jest vs “import statement outside a module”

Jest can be very helpful framework when testing your application. Until it isn’t. Sometimes it gets in the way, and to configure it properly can be quite tricky. Problematic use case So, you have just learned that it is better to use specific imports instead of the { destruct } syntatx. Why? Because it makes …

Problem with NGCC

NGCC stands for Angular Compatibility Compiler, which recompiles various npm packages to Ivy format. Most of the time it “just works”, expect when it does not. There are configuration options for ngcc, which you can specify in ngcc.config.js file in root folder of your project. But sometimes this seems not enough. Sometimes the same code …

Load Image programatically with Promise

Image can be loading either in a standard way via setting the src property on the Image tag, or you can do it programatically. If you do it programatically, you can enhance the image loading with some magic, eg show a animated CSS placeholder while the image is being loaded. Or you can try several …

Useful Typescript / Angular code snippets

Below are some useful code snippets I wrote. I use them as a reference, because they when I occasionally need them, I never know them by heart. Hope this will help you too. If so, let me know in the comments. Convert enum to array Set all controls in Angular dynamic form to readonly Get …

VisualStudio has problem when multiple versions of Typescript are installed

You can have several versions of Typescript installed on your machine and each project in Visual Studio can be configured to use different version by specifying that version in .csproj file. Like this But you might still have problems with IntelliSense for some native javascript objects. VisualStudio uses file lib.d.ts  to learn interfaces of window objects, events, …