Home » Posts tagged "typescript"

This One Tweak Improved my Angular Code

I made a tweak to my Angular code process over the last month or so that has resulted in greater productivity in my development environment and fewer bugs.

Now, I didn’t make this change because I thought it would improve my productivity.  At least that wasn’t the primary reason.  I made the change because I thought it would reduce the chance of introducing bugs into my code.  And while it does reduce the number of bugs in my code, the result has been generally improved productivity.

What is this great secret?

This One Tweak Improved my Angular Code
Photo credit: docoverachiever via Visual Hunt / CC BY

Continue reading “This One Tweak Improved my Angular Code”

TypeScript Basics for Angular Developers

For the most part, TypeScript feels a lot like JavaScript.  Most people pick it up without having any formal training.  

But, here’s the deal.  “Just because you can, doesn’t mean you should.”

The thing that makes me most nervous about Angular is that it is structured so that you can write some really clean code.  But, you don’t have to.  Which mean most won’t.

In fact, recruiters continue to contact me about Angular jobs with rates that make it obvious that hiring an Angular programmer is the same as hiring an HTML “programmer” 10 years ago.  Sorry gang, JavaScript has grown up and so has Angular.

So, here are a few things you need to know about TypeScript that will make you a better Angular developer.

TypeScript Basics for Angular Developers
Photo credit: MIKI Yoshihito. (#mikiyoshihito) via VisualHunt.com / CC BY

Continue reading “TypeScript Basics for Angular Developers”

Enforce TypeScript Functional Programming

As consistent readers of this blog are aware, I’ve fallen in love with Functional Programming.  But I also live in a primarily Angular/TypeScript world where some code is still Object Oriented and other code is more Functional in nature.  And while TypeScript lets you do some Functional things, I’ve found it hard to force functional concepts in TypeScript.  So, I’ve gone searching.  Wouldn’t it be great if there were some sort of flag you could set that said, “Hey compiler, I’m in ‘Functional’ mode now!”  And the compiler would make sure that you never used a conditional statement, never accessed hidden parameters, and never mutated state?

Well, I think I’ve figured out some of how to manage all of this using nothing more than TypeScript and some TSLint rules.

Photo credit: archer10 (Dennis) 99M Views via VisualHunt.com / CC BY-SA

Continue reading “Enforce TypeScript Functional Programming”

Jedi Angular 2 Tips and Tricks

This week, I thought I’d collect a list of unrelated tricks and tips I’ve learned over the last couple of weeks into one post.  Unless you love to read documentation, or you’ve run into problems that these tips solve, I’m guessing you don’t know most of these.

But first, the big new this week…

Jedi Angular 2 Tips and Tricks
Photo credit: iamkory via Visual Hunt / CC BY

Continue reading “Jedi Angular 2 Tips and Tricks”

Accessing Private Fields in TypeScript

Have you ever needed to access a private field in TypeScript?  The most common place you may find yourself needing to do this is while writing a unit test.  But, I also found myself needing to do this while using a JavaScript library where the field wasn’t declared in the type file for the library I was using.

Now, suppose you could access those private fields effortlessly and easily.  How valuable would that be to you?

Accessing Private Fields in TypeScript
Photo via VisualHunt

Continue reading “Accessing Private Fields in TypeScript”