ospec.d.ts
Closed this issue · 6 comments
Hi, I made a quick stab at writing TypeScript definitions for ospec.
https://gist.github.com/maranomynet/1368f8ce0fd344efcd3b9dd5dea637b4
(BTW: Any corrections or improvements would we much appreciated.)
So, what would be the appropriate next step in order to get this published somewhere?
@maranomynet Apologies, I had started work on this a while ago (repo here) but haven't put aside the time to actually finish it off.
I took a quick look at yours, and it looks like you have some types I missed. Our approaches are a bit different, I'm not sure if one has an advantage over another.
I'm totally fine with you taking the lead and submitting to Definitely Typed if you like, I probably won't have much time to get back into this until next week.
I'm a bit of a newbie when it comes to writing definitions, and it shows.
So nice to learn from how your approach is different.
I'll fork DefinitelyTyped, make an ospec branch based on your definition file, adding the missing bits and some "tests", and then @-mention you for a quick review/sanity check before submitting a formal PR.
Sound ok?
Sure, you can include isiahmeadows on that as well.
One thing I was going for with my definitions (which might also work with yours, I haven't tested them) is you can just import o from 'ospec'
and all types are available on o
. Eg: o.Results
, o.Test
, etc.
I see. What would be the use case where one needs direct access to Results
, Test
, etc.?
err... I guess Results
and Reporter
are useful, but what about Test
and Spy
and Assertion
?
(I'm simply curious.)
Not sure there will always be a use case, I just don't like to be in a situation where I can't declare the type of something in userland.
let test: o.Test
// later...
test = o(value, f)
// or
function myfunc (spy: o.Spy<A, R>) {...
All types in the Ospec namespace are automatically available to userland code.