Re:An introduction to type programming in TypeScript
by sfvisser on Wednesday February 02, 2022 @02:23AM
(#30174760)
The article seems to be mixing up type synonyms with type variables. Type variables have an actual well defined meaning. They act like variables that can be instantiated during inference/checking, analogue to how variables in the expression language get instantiated at runtime.
[ Parent
| on HN ]
Re:An introduction to type programming in TypeScript
by rendall on Wednesday February 02, 2022 @08:51AM
(#30177457)
> Type variables have an actual well defined meaning.
In TypeScript or JavaScript? Can you say more?
Re:An introduction to type programming in TypeScript
by sfvisser on Wednesday February 02, 2022 @11:01AM
(#30179365)
Type variables are sometimes called generics and a part of the type language, so JavaScript doesn’t have them. Typescript, but also Rust, Haskell, Java, the ML-family have them.
Type variables abstract over types and are analogous to function parameters at the values level. Think the ‘T’ in ‘List<T>’.