Skip to content
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 terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webhook): typing webhook request handler #356

Merged
merged 1 commit into from
Aug 15, 2023
Merged

fix(webhook): typing webhook request handler #356

merged 1 commit into from
Aug 15, 2023

Conversation

yhsiang
Copy link
Contributor

@yhsiang yhsiang commented Aug 11, 2023

  1. typing type of webhook event which is not found in the '@line/bot-sdk'
  2. typing context

@yhsiang yhsiang requested a review from MrOrz August 11, 2023 07:14
@@ -187,8 +191,9 @@ const singleUserHandler = async (
return;
}

input = postbackData.input;

const input = postbackData.input;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got this when running eslint:fix

 193:5   error    'input' is never reassigned. Use 'const' instead    

@coveralls
Copy link

coveralls commented Aug 11, 2023

Pull Request Test Coverage Report for Build 5863817242

  • 8 of 14 (57.14%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 91.049%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/webhook/index.ts 8 14 57.14%
Totals Coverage Status
Change from base Build 5392086039: -0.03%
Covered Lines: 978
Relevant Lines: 1050

💛 - Coveralls

createGreetingMessage(),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on Slack we decided to create a new ticket for typing handlers/tutorial and removing ts-ignore here.

Copy link
Member

@MrOrz MrOrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the root cause of many otherField as OOO is that we separate type from other fields.

We could have used discriminated union to properly narrow down the message type, but we somehow removed the discriminator (type) from the otherField, making narrowing impossible. We can merge this first and see if we can remove this otherField together in the future.

@yhsiang yhsiang merged commit 3d143d7 into master Aug 15, 2023
2 checks passed
@yhsiang yhsiang deleted the webhook-ts branch August 15, 2023 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants