Open SimonMeskens opened 6 years ago
your Equal
approach was what I'd try as well.
I thought Partial<[1,2,3]>
yielded Array prototype methods (fwiw) but I never managed for other prototypes.
Alright, no problem. I figured as much, seeing as Typical doesn't have it :)
I'm trying to use the Equal to set up semantic tests. I tried using type-checker, but it doesn't like my project somehow. Is Tsst ready for light production use? I haven't heard about it in a while.
It kinda worked for me, yeah. Small target audience though. So I forked it to e.g. let the consuming lib decide on TS version. I had trouble using TS off git tho (npm worked okay).
I need a type that is able to distinguish
Promise<any>
fromPromise<number>
.This is as far as I've gotten:
It works for
ObjectEqual<Array<any>, Array<number>>
, but not forObjectEqual<Array<Array<any>>, Array<Array<number>>
, norObjectEqual<Promise<any>, Promise<number>>
.As far as I can tell, there's nothing you can do in the language where
Promise<any>
reacts differently fromPromise<number>
, same for deeply nested arrays, without going recursive.I'm hoping there's some sort of trick that applies here where you can get a type into weird state where the two are distinguishable (in the vein of NoInfer).