Generics
↔ generic (algebraic) placeholder to work with any variety of Types, but allow Type Inference to catch specific Type
Source: www.typescriptlang.org/docs/handbook/2/generics.html
Generics in other Programming Language = JS Syntax for creating reusable components that can work with variety of Types
Regular function exist at Dynamic Level & are factory for Values with Parameter representing Values
const valueFactory = (x: number) => x
const myValue = valueFactory(123)
**Parameterized types** are factory for [<span data-tooltip-id='preview__ygphzmh7qYAjMwdE2'>Type</span>](type)s with [<span data-tooltip-id='preview__oJpWA75QTKnSAduZp'>Param</span>](parameter) to rep [<span data-tooltip-id='preview__ygphzmh7qYAjMwdE2'>Type</span>](type)stsxtype TypeFactory<X> = Xtype MyType = TypeFactory<string>
interface ValueContainer<Value\> {
value: Value
}
type StringContainer = ValueContainer<string\>
Type Variable
One or more Type Variable introduced via Angle Bracket Notation
Generic Type
factory for Types, defined using Angle Bracket Notation, to annotate with Generic Type Placeholder for TSC to infer & fill in
Generic Type Parameter
(convention to use) single uppercase character for Generic Type Parameter
Generic Type Variable
special Variable that works on Types instead of Values