Type Safe State Machines in TypeScript

State machines are everywhere but I don’t think they get enough air time. To remedy the situation I’m going to present an implementation in TypeScript and use it to model a very simple elevator.
I could point you to the definition of what a state machine is on Wikipedia but the name gives it away. State machines consist of states and a description of how to go from one state to the next. So let’s start spelling things out.

Link: https://dzone.com/articles/type-safe-state-machines-in-typescript?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Type Safe Message Dispatch in TypeScript

TypeScript continues to be amazing. Anders and team are doing an incredible job making the language accessible and at the same time powerful enough to express interesting invariants that can be encoded with conditional and mapping types.
I’m currently working on a workflow toolkit and building it in TypeScript has allowed me to express the message dispatch logic in a type safe way. Putting the pieces together has been a lot of fun so I’m going to outline the pattern in case others find it useful.

Link: https://dzone.com/articles/type-safe-message-dispatch-in-typescript?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Building Mobile Apps With Angular or Vue.js and NativeScript {N}

More and more Java developers have been coming into contact with front-end development in recent years. For this group of developers, it is only a small step to switch to mobile app development with NativeScript. In this post, we try to clarify the possibilities of native and hybrid app development using NativeScript.
What Is NativeScript {N}?
{N} is an open source framework (under the Apache 2 license) to build native iOS and Android apps, using TypeScript and Angular. {N} is a different technology than the hybrid frameworks, such as Ionic and Phonegap. {N} is a runtime, not a web technology. Your app will not run as a mini website in a WebView and is therefore more efficient. With {N} you have direct access to all the Native APIs of your device.

Link: https://dzone.com/articles/building-mobile-apps-with-angular-and-nativescript?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Import Statements in TypeScript: Which Syntax to Use

TypeScript has multiple different syntaxes for imports. When should you use which?
Most of the Time, the Module Exports Multiple Things
There are two great ways to import from another module in TypeScript, when the module exports an object with properties. This is the common case.

Link: https://dzone.com/articles/import-statements-in-typescript-which-syntax-to-us?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

JEC: Working With jslets in Node.js

This article shows how to create web applications, a la JAVA, over Node.js by using the “JavaScript Enterprise Container" (JEC) specification and its default implementation: GlassCat application server.
Prerequisites
In order to follow this tutorial, you need to install a GlassCat server instance and deploy a basic JEC project.

Link: https://dzone.com/articles/jec-working-with-jslets-in-nodejs?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Why You Should Use TypeScript for Developing Web Applications

Defining TypeScript
TypeScript is an object-oriented programming language developed and maintained by the Microsoft Corporation. It is a superset of JavaScript and contains all of its elements.
TypeScript totally follows the OOPS concept and with the help of TSC (TypeScript Compiler), we can convert Typescript code (.ts file) to JavaScript (.js file)

Link: https://dzone.com/articles/what-is-typescript-and-why-use-it

Angular: A Developer’s First Choice

The job of a web developer is becoming more complex. With the number of browsers increasing at a rapid rate and developed web pages behaving differently in each one of them, cross-browser testing has emerged as a necessity to every web developer as the browser preferred by the end-user is unknown to them. However, there are many new frameworks that have made it easy for web developers to create browser compatible websites. The most famous framework is the one developed by Google, Angular. In this article, we shall discuss why Angular has become developers’ first choice and how its features are used by renowned web apps. Why Angular Is Popular Among Developers The main reason behind the popularity of Angular is its robustness, platform independence, and browser support. Currently, all major browsers are supporting Angular. The Angular team releases new updates at frequent intervals and new features are constantly added for enhanced user experience. Although certain custom elements are not natively supported by Firefox, but they are compatible with the upcoming release.

Link: https://dzone.com/articles/angularjs-a-developers-first-choice?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev

Reflecting on TypeScript, Lambdas, and, of Course, Testing

Yet another long-overdue post. The last couple of weeks (or perhaps Sprints) my team has dived into TypeScript for a new project. I like it, really like it. Maybe that’s just because for years I’ve feared JavaScript, haven’t understood enough about how to do unit testing, and found myself writing terrible code and just running it to find the bugs. This is not a very good development methodology.
TypeScript and IDEs
This time around I’m using a great IDE (Visual Studio Code, of course), have type packages for just about everything we are working with, and am writing unit tests. I have persisted for many years just using Vim (in the recent history, mostly for writing Go), and because my job has frequently been quite varied and I’m often too lazy to install plugins or custom editor scripts, it didn’t have anything really helping me with my coding. I think the only times in the last 8 or 9 years I’ve genuinely wanted, needed, and used an IDE has been for writing Flash ActionScript 3.0 and Java (IntelliJ IDEA in both cases). That’s not counting the dabbling in Unity/UnrealEngine where I’ve used MonoDevelop or Visual Studio.

Link: https://dzone.com/articles/reflecting-on-typescript-lambdas-and-of-course-tes

Freeze-Mutate: An Immutable Object Management Library for JS and TS

I was looking for a nice little module that would help me make my DTOs immutable. The libraries I found were either an overkill (immutable.js), lacking support for deep merging of objects during mutations, or they were making my code ugly with lots of function calls for each change. So that’s how freeze-mutate came to life: a Javascript/Typescript-based npm module that helps me keep things simple and neat.

Freeze any object and it becomes deeply-immutable: all its properties and child-objects are frozen in the process. This is done by recursively calling JavaScript’s native Object.freeze.
Mutate a frozen object with a change-set and you get a new frozen object that is a merge, or an overlay, of the change-set on top of the original object. Again, this is a deep-merge that also you to works with Arrays, Sets, Maps, and your own custom classes. For the brave: you can provide custom freeze and merge functions.
Using TypeScript you get all the goodies of generics, enforcing the validity of the change-set, Readonly returned types and interfaces for the custom functions.

Enough talking. Let’s dive in…

Link: https://dzone.com/articles/freeze-mutate-an-immutable-object-management-libra?utm_medium=feed&utm_source=feedpress.me&utm_campaign=Feed%3A+dzone%2Fwebdev