typings / registry

The registry of type definitions for TypeScript
238 stars 176 forks source link

hapijs, expressjs, koa for server end #102

Open naivefun opened 8 years ago

Fank commented 8 years ago

Doe you mean https://www.npmjs.com/package/hapi with hapijs ?

aliatsis commented 8 years ago

+1

ghost commented 8 years ago

+1

stevehipwell commented 8 years ago

+1 for express

joshwiens commented 8 years ago

So as I write my APIs in TypeScript and I'm tired of the sad state of back end type definitions, I'm picking this one up.

Starting with what I need now which is Express and moving to what I will need soon which is Hapi.

JoshGlazebrook commented 8 years ago

@d3viant0ne I'd take a look at the express definitions on DT first.

joshwiens commented 8 years ago

@JoshGlazebrook I have, they aren't written to work with Typings and are 13 minor versions out of date. A problem I am tired of contending with.

JoshGlazebrook commented 8 years ago

@d3viant0ne Yea I've noticed that too. I was thinking as more of a starting point so you don't have to do it all from scratch (if you don't want to).

joshwiens commented 8 years ago

Oh, yeah. I have no intention of writing all of that from scratch though I do have to go through and verify all of it.

I'm going to do the work here - https://github.com/DeviantJS/npm-express

I should have time to dig into express this weekend.

@blakeembrey Once I have this finished, if you / the Typed Typings crew want the repo with the rest of the official ones, i'll transfer it over.

blakeembrey commented 8 years ago

@d3viant0ne Do you have/want access to Typed Typings? I'd be happy to add you and you can create whichever repos you want for this (and add others here that are interested).

buildjosh commented 8 years ago

@blakeembrey I definitely want to add some for some of the more prominent hapi plugins.

buildjosh commented 8 years ago

Damn, @blakeembrey I meant to post that ^ from @JoshGlazebrook (this @buildjosh is my work github account). I guess it doesn't help that I just look at all inboxes on my phone.

felixfbecker commented 7 years ago

I have https://github.com/felixfbecker/typed-express and https://github.com/felixfbecker/typed-serve-static finished but I am struggling with the cyclic dependency between them. express exports serve-static under express.static, but serve-static has some functions that need the interfaces from express (specifically, the Request interface). How can this be solved with typings?

unional commented 7 years ago

serve-static does not depends on express: https://github.com/expressjs/serve-static/blob/master/package.json#L9-L12 Does it mean Request comes from one of those? Or Request is originated form serve-static and express should get that form it?

felixfbecker commented 7 years ago

But the typings depend on it, thats the problem. The typings from DefinitelyTyped referenced the RequestResponse interface. Which technically is not even 100% correct, because serve-static can also be used with a vanilla node server, in which case res will just be a http.ServerResponse object. I managed to replace all references and added extra tests to ensure that everything can still be used with express.

DefinitelyTyped solved this by introducing a virtual express-serve-static-core typing, which I want to avoid at all cost :)

felixfbecker commented 7 years ago

And here is body-parser https://github.com/felixfbecker/typed-body-parser

blakeembrey commented 7 years ago

@felixfbecker You should be able to write it depending on raw http. Better yet, with this sort of thing you can actually just type the minimum interface that is required and if http.Request or express.Request satisfies it you're in business 😄