Very cool that the language allows specification of a type in this way.
I added a similar type — “non-empty-string” to a typechecker for PHP, and it’s been adopted widely in the PHP ecosystem. It turns out to be pretty handy, especially when there’s a full type system to support it.
Very cool that the language allows specification of a type in this way.
I added a similar type — “non-empty-string” to a typechecker for PHP, and it’s been adopted widely in the PHP ecosystem. It turns out to be pretty handy, especially when there’s a full type system to support it.
Language is not mentioned in a title, so my first thought was about TypeScript type wizardry. Turns out it's as simple as `Exclude<string, "">`.
https://www.typescriptlang.org/docs/handbook/utility-types.h...
It's simple, and it doesn't work as `Exclude` only applies to union types. For type `string` it just returns the same type `string`.
It is very much mentioned in the article title and the first sentence. It's just HN that's truncated the title.
"Huh never heard of Bellroy... I wonder what they're using Haskell for..."
Turns out it's some kind of bags and accessories brand!
I pondered for a while, it IS the company I used to know
[dead]