Typescript for Java Developers: Index Types

A fairly recent addition to Typescript is index types and the keyof operator. For a Java developer this is an interesting thing to learn about, as Java doesn’t have this feature, specifically due to type system inflexibility. Academically speaking, an index type is a small facet of dependent type systems (where one type in use is dependent upon the value of another input). This is also, in effect, a way to get many of the benefits of a heterogenous map.[Read More]

Typescript for Java Developers: De-Structuring of Variables

ECMAScript is all about wrangling loosely typed variables. In a compiled and strongly typed language like Java, classes have a fixed shape (aka schema) and every object follows that pattern strictly. With ECMAScript, objects are more “ad-hoc” in that any single object be comprised of any combination of properties. Prototypes help with pre-defining that combination, but you can muck around with it all you want. Consequently, there is an opportunity for language features around lifting, shifting, filtering, and moving around properties from objects.[Read More]

Typescript for Java Developers: Variable Scoping

When learning a language built on another existing platform, like TypeScript (or, for that matter Kotlin), one of the challenges you face is understanding the underlying platform or language so that you can, in turn, understand how the higher-level language is applied to meet the restrictions and features of the lower-level language. Inevitably, no amount of documentation for a language built upon another language or platform is complete without some degree of knowledge of the underlying platform.[Read More]