Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
gvergnaud
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
Type-Level TypeScript – Objects and Records
(type-level-typescript.com)
1 points
by
gvergnaud
4y ago
|
0 comments
2.
▲
by
gvergnaud
4y ago
Actually, this won't work with union types! The definition of `Equal` I use is this one: type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends < T >() => T extends Y ? 1 : 2 ? true : false; Understandi
3.
▲
by
gvergnaud
4y ago
It's actually not in the standard library, but you can write it yourself: type Expect<T extends true> = T; `T extends true` puts a type constraint on the parameter, which then needs to be assignable to the literal type `true` t
4.
▲
by
gvergnaud
6y ago
Thanks! Hope you'll enjoy using it
5.
▲
Bringing Pattern Matching to TypeScript Introducing TS-Pattern v3.0
(dev.to)
7 points
by
gvergnaud
6y ago
|
2 comments