8000 fix: add TypeScript type definition for request.earlyResponse by iiroj · Pull Request #1277 · middyjs/middy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: add TypeScript type definition for request.earlyResponse #1277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our 8000 terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 26, 2025
Merged

fix: add TypeScript type definition for request.earlyResponse #1277

merged 5 commits into from
Feb 26, 2025

Conversation

iiroj
Copy link
Contributor
@iiroj iiroj commented Feb 25, 2025

This PR adds TypeScript type definitions for the Request.earlyResponse field. Fixes issue #1275

@willfarrell
Copy link
Member

Thanks for the PR, I think it needs a small update

packages/util/index.test-d.ts:22:6
  ✖  22:6  Property earlyResponse is missing in type { event: { body: string; headers: {}; multiValueHeaders: {}; httpMethod: string; isBase64Encoded: false; path: string; pathParameters: {}; queryStringParameters: {}; multiValueQueryStringParameters: {}; stageVariables: {}; requestContext: { ...; }; resource: string; }; context: { ...; }; response: null; error: null;... but required in type Request<APIGatewayProxyEvent, APIGatewayProxyResult, Error, Context, TInternal>.  
/home/runner/work/middy/middy/packages/core/index.test-d.ts:429:16: Unnecessary parentheses around expression. (@typescript-eslint/no-extra-parens)

@iiroj iiroj marked this pull request as draft February 25, 2025 20:06
@iiroj
Copy link
Contributor Author
iiroj commented Feb 25, 2025

I'll fix the PR tomorrow now that the release issue is sorted out!

Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

🚮 Removed packages: npm/@middy/core@6.1.1, npm/@middy/util@6.1.1

View full report↗︎

@iiroj iiroj marked this pull request as ready for review February 26, 2025 06:16
@iiroj
Copy link
Contributor Author
iiroj commented Feb 26, 2025

@willfarrell ok the PR should be good now, although I got into a bit of a rabbit hole with the development setup:

  1. After running npm install I got this diff in package-lock.json: c0e6d72
  2. I noticed Husky wasn't set to be automatically setup, so I added the prepare script: 3f71cef
  3. The TypeScript files weren't being linted during commit, so I added them: d6e0dba
  4. This revealed some formatting changes to the existing test file: da16876
  5. Finally, the fix itself: f0dabe5

@iiroj
Copy link
Contributor Author
iiroj commented Feb 26, 2025

Btw, I think the current prettier and ts-standard formatters are conflicting with each other a bit.

@willfarrell willfarrell self-assigned this Feb 26, 2025
@willfarrell willfarrell merged commit f5ceed7 into middyjs:main Feb 26, 2025
7 of 9 checks passed
@willfarrell
Copy link
Member

Amazing stuff. Thanks!

I think the current prettier and ts-standard formatters are conflicting with each other a bit.

I'm aware, kind of a legacy thing. I've added it to the v7 release to be updated.

@iiroj iiroj deleted the add-early-response-type branch February 26, 2025 15:41
@iiroj
Copy link
Contributor Author
iiroj commented Feb 26, 2025

Thanks @willfarrell, I think this PR caused an issue in the TypeScript test fixtures in the @middy/util package: #1279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0