Skip to main content

TypeScript: In Praise of Union Types

· 7 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

(& How to Express Functions in UTs)

Have you heard the good news my friend? I refer, of course, to the shipping of TypeScript 1.4 and my favourite language feature since generics.... Union Types.

Gulp, npm, long paths and Visual Studio.... Fight!

· 3 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

How I managed to gulp-angular-templatecache working inside Visual Studio

Every now and then something bites you unexpectedly. After a certain amount of pain, the answer comes to you and you know you want to save others from falling into the same deathtrap.

There I was minding my own business and having a play with a Gulp plugin called gulp-angular-templatecache. If you're not aware of it, it "Concatenates and registers AngularJS templates in the $templateCache". I was planning to use it so that all the views in an Angular app of mine were loaded up-front rather than on demand. (It's a first step in making an "offline-first" version of that particular app.)

What's in a (Domain) Name?

· 3 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

The observant amongst you may have noticed that this blog has a brand new and shiny domain name! That's right, after happily trading under "icanmakethiswork.blogspot.com" for the longest time it's now "blog.icanmakethiswork.io". Trumpets and fanfare!

Unit Testing an Angular Controller with Jasmine

· 8 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

Anyone who reads my blog will know that I have been long in the habit of writing unit tests for my C# code. I'm cool like that. However, it took me a while to get up and running writing unit tests for my JavaScript code. I finally got there using a combination of Jasmine 2.0 and Chutzpah. (Jasmine being my test framework and Chutzpah being my test runner.)

Getting more RESTful with Web API and IHttpActionResult

· 3 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

Up until, well yesterday really, I tended to have my Web API action methods all returning 200's no matter what. Successful request? 200 for you sir! Some validation error in the model? 200 for you too ma'am - but I'll wrap up the validation errors and send them back too. Database error? 200 and and an error message.

A folk story wherein we shall find dates, DataAnnotations & data impedance mismatch

· 5 min read
John Reilly
OSS Engineer - TypeScript, Azure, React, Node.js, .NET

If you ever take a step back from what you're doing it can sometimes seem pretty abstract. Here's an example. I was looking at an issue in an app that I was supporting. The problem concerned a field which was to store a date value. Let's call it, for the sake of argument, valuation_date. (Clearly in reality the field name was entirely different... Probably.) This field was supposed to represent a specific date, like June 15th 2012 or 19th August 2014. To be clear, a date and *not* in any way, a time.