20
If you want to get a quick handle on what Typescript is all about,
and you have experience with other programming languages,
this post will give you a high-level overview of what is special about Typescript.
Typescript’s take on type checking is unusually expressive compared to
similarly popular type-checked languages.
That’s because Javascript, being a dynamically typed language, is extremely
flexible.
Typescript is designed to let you write Javascript almost as freely as you normally
would,
but with accurate type-checking added on.
Whether or not you have experience with type-checking in other languages,
it is helpful to learn the particulars of the Typescript way…


You can disagree on 5 and 6, but you are wrong. This is not a matter of opinion.
I’ve already conceded on point 6 that types are not technically functions, and that I’m making an analogy. I think analogies are in the territory of opinions.
If you really want to argue technical correctness on point 5 then let me try to illustrate more clearly what a type parameter list is. First I’ll cite some sources to clarify terminology.
From the Wikipedia article on Generic programming (emphasis mine):
That sentence cites the book “Programming Languages: An Active Learning Approach” by Kent D. Lee, which uses both the terms “type parameter” and “type argument”.
The Typescript Handbook page on Generics uses the terms “type parameter” and “type argument” many times. Here are some excerpts:
(I know we’ve been talking about functions, not classes. But both have type parameter lists, and it’s the same concept in both cases, so I think this line is relevant.)
I think we can clearly establish this terminology as it relates to one of the examples from my article:
And you can see here how type arguments bind to type parameters in a way that is directly analogous to value arguments binding to value parameters:
Your counterargument that “Generic functions can have the type specified” is just a different way of saying that a type argument binds to a type parameter.
Just in case the issue is with the use of the word “list”, a generic function can have multiple type parameters. Thus, a list. Here is another example from my article that demonstrates a list of type parameters:
Note that
getOrDefaulthas a type parameter list, and also has a value parameter list (or simply “paremeter list” if you prefer). Therefore it has two parameter lists.Is the problem that when I use the words “parameter list”, to you that means specifically what I’ve been calling value parameters? And that’s not the same thing as type parameters? I think I’ve been very clear that I’m talking about two lists with different kinds of parameters. If that’s the issue then please make some allowance for the way I’m using terminology, and for the context in which I’m using it.
Maybe the issue is that functions can be called with only value arguments? Or that non-generic functions don’t have a type parameter list? I think I addressed this in my article. Type arguments are implicit, so they can be omitted from call sites. But the type parameter list exists in the generic function definition either way. A non-generic function doesn’t have a type parameter list - but I think an equally valid interpretation is that it has an empty type parameter list, which is expressed in the language by omitting the angle brackets.
Anyway, there’s no way you can say it isn’t true that some functions have two parameter lists when type parameter lists are a thing, and value parameter lists are a thing, and generic functions have both.
You can say that I’m overgeneralizing by saying that all functions have two parameter lists when actually only generic functions have two parameter lists. But I think you’d have to be pretty pedantic to say that makes my point wrong. I think it would be glossing over a nuance. If this is the point you disagree on then let me know.
Or you can say, as I do, that all functions do have two parameter lists, but for non-generic functions the type parameter list is empty, so we don’t write it. That’s my interpretation - or in other words, my opinion, which is not a matter of fact.
Thank you. I’ll educate myself more.
Yeah, I meant what you called pedantic. This article seems targeted at noobs and telling them that functions take 2 argument lists is misleading.