A generic class includes one or more type parameters that will be substituted with actual types when the class is used. If the class has more than one type parameter, all parameters must be substituted when the class is used. Here's an example of a g…
When working with conditionals types, within the “extends” expression, we can use the “infer” keyword to either get the type of the elements of an array, or even to get the return type of a function. We can use this to build a “FnReturnType” type, th…
You can convert to an enum value from its underlying type by casting the underlying type (e.g. int) to the enum type. However, when you cast a value that doesn't have a corresponding enumerator in the type, you don't get any sort of error. In the exa…
Preface Validating data is a common task that occurs throughout all application layers, from the presentation to the persistence layer. Often the same validation logic is implemented in each layer which is time consuming and error-prone. To avoid dup…
Debuger Great questions These questions will solve most bugs: what method shows the symptom ? what lines of code produces that symptom ? what is the state of the receiver object in that code ? what were the param values passed in ? if it’s an excepti…