You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recognize the Generic constraint syntax with the extends keyword, but what about the = http.Server part? Is this like a default parameter or something?
Whatever this syntax means it should be better documented.
I tried googling for this syntax by searching
typescript generic constraint
typescript generic constraint assignment
typescript generic defaults
The text was updated successfully, but these errors were encountered:
Ahh i see. I was looking at the wrong documentation. I think what deterred me from this page originally was that it was v2.3 not v3. I don't like to read different major version docs because it can have unsupported information
It's near impossible to find out what this syntax does if you haven't already guessed that it's for generic parameter defaults. The syntax is un-Googleable. I had to use an AST browser to figure out what was going on!
A vote from me for this to be documented on the Generics page.
4 years after this syntax was introduced, I had to ask in the Typescript discord to get an answer to this. As mentioned by @rossng, completely impossible to google, or find from the TS docs.
In the declaration file for Fastify (https://github.com/fastify/fastify/blob/master/fastify.d.ts) there is some TypeScript code I do not recognize and cannot find another example of in the TypeScript documentation:
I recognize the Generic constraint syntax with the
extends
keyword, but what about the= http.Server
part? Is this like a default parameter or something?Whatever this syntax means it should be better documented.
I tried googling for this syntax by searching
typescript generic constraint
typescript generic constraint assignment
typescript generic defaults
The text was updated successfully, but these errors were encountered: