dougmoscrop / serverless-http

Use your existing middleware framework (e.g. Express, Koa) in AWS Lambda 🎉
Other
1.74k stars 167 forks source link

Added types for serverless-http type definitions #65

Closed awwong1 closed 5 years ago

awwong1 commented 5 years ago

https://github.com/dougmoscrop/serverless-http/issues/64

dougmoscrop commented 5 years ago

looks straightforward to me - is there any kind of test or something that can help guard against regressions - example lets say I change the signature (no plans to, but hypothetically), is there a test that can check that the type matches the function signature, at least on some simple level? or is the onus on the maintainer to keep them in sync?

awwong1 commented 5 years ago

@dougmoscrop One way that you can verify your types are valid is to just build a typescript application using the types that are defined. Similar to a PR I made here https://github.com/fastify/fastify-react/pull/45

dougmoscrop commented 5 years ago

landed via bca797ac752f0b8ff912b833e858790878ed7a7e and released in 1.9.1

dougmoscrop commented 5 years ago

@awwong1 this appears to be causing issues for TypeScript users

https://github.com/dougmoscrop/serverless-http/issues/78

awwong1 commented 5 years ago

I've updated the PR such that the type dependency is no longer a dev dependency but is an optional dependency. I also verified that this works on a new TypeScript application that does not have @types/aws-lambda installed:

npm init -y
npm install typescript
npm install https://github.com/awwong1/serverless-http

echo "import serverlessHttp from \"serverless-http\";
serverlessHttp(() => { });" > index.ts

npx tsc index.ts 

Hopefully this is sufficient?