Lately, I've been posting a bunch of really fun content in a series called Mastering Unit Testing on Twitter. The latest tweet is here on the difference between DAMP and DRY in unit testing.
Please go give it a look and like/retweet.
So this is totally valid:
Ultimately, const is a little better than a comment when you declare a variable.
So there are two ways to improve this. First, follow the long time tradition of making constants all uppercase.
The second and even cooler way is to use the Readonly type in TypeScript. Thanks to Val Neekman for this sample:
And now, you get REAL constants, not half ones…
Signup for my newsletter here.