Hybrid Types In TypeScript

Yesterday I’ve been refactoring one of our internal library in GWI from JavaScript to TypeScript. As a JavaScript veteran I like to use some edgy non-conventional & pre-ES 2015 coding styles. I’m not using prototype, class or this much often. I’m rather using Factory Constructor Pattern quite often as well as Higher Order Functions for simulating currying and like to with objects and play with scopes. Now you might think that this is silly. No one will understand my code and using truly private functions makes it harder to extend functionality. And you’re right:D Anyway I know that I can write more reliable code more quickly and from my experience when code is reliable enough not many people will need to change it. And when they do they are mostly experienced and are able to understand it. Also I like private functions. If you miss any functionality or abstraction it’s always good idea to add it directly to library or write your own than hack it. Anyway this article is not about these patterns and how to use them but rather about how it feels when you put TypeScript in the mix. If you want to learn more about these patterns DuckDuckGo some other article.

First let me explain one thing. I’m not writing TypeScript day to day. But when I do I’m mostly exploring edges of what it can do. I’m writing a lot of ES 2015 ECMAScript in work and Elm for fun (what is slowly changing since we already shipped first feature written in Elm elm as part of our production Ember.js app).

READ WHOLE ARTICLE

Like what you read? Give Marek Fajkus a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.