3 ms·
Something I've long wanted is a type-explainer - something that will let me highlight parts of a type definition and tell me in English what the fragment means.
by vosper 4y ago
Something I've long wanted is a type-explainer - something that will let me highlight parts of a type definition and tell me in English what the fragment means. The example that OP linked elsewhere in this thread [0] is a good one - I know what parts of that mean, but I've never seen "T extends string = string" before.
[0] https://news.ycombinator.com/item?id=32569708 https://news.ycombinator.com/item?id=32569708
- Smaug123 4y agoIt's just "T extends string", with a default value of `string` if you don't supply T.
- deleted 4y ago[deleted]
- sedro 4y agoAnd the purpose of "T extends string" is to carry the value of a string literal. For example, there's the string value "foo", but there's also a type "foo" which extends string and has only the one possible value.
- throwaway247322 4y agoThat would be cool to see, actually reminds me of the cdecl explain project [1]. [1] https://cdecl.org/ https://cdecl.org/