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: avoid mapped type during filter query type narrowing #553

Merged
merged 11 commits into from
Apr 1, 2024

Conversation

KnorpelSenf
Copy link
Member

@KnorpelSenf KnorpelSenf commented Apr 1, 2024

The mapped type AliasProps prevents us from leveraging the improvements in microsoft/TypeScript#57871. Hence, even though microsoft/TypeScript#57863 was fixed as a consequence of #543, we are still seeing problems like #551 appear using typescript@next.

This PQ removes the helper type and inlines its functionality into the existing collection of Shortcuts. In addition to fixing #551, this removes complexity and improves consistency. However, it reduces code reuse a little bit, which is acceptable.

You can only test these changes on Node, since Deno does not ship with typescript@next yet, which you need to install. You can try out these changes with npm install github:grammyjs/grammY#avoid-mapped-type as usual.

Closes #551.

@KnorpelSenf KnorpelSenf requested a review from KnightNiwrem April 1, 2024 09:52
@KnorpelSenf KnorpelSenf changed the title Avoid mapped type during filter query type narrowing fix: avoid mapped type during filter query type narrowing Apr 1, 2024
Copy link

codecov bot commented Apr 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.07%. Comparing base (38efc3c) to head (8598b02).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #553      +/-   ##
==========================================
- Coverage   46.08%   46.07%   -0.01%     
==========================================
  Files          19       19              
  Lines        6052     6051       -1     
  Branches      320      318       -2     
==========================================
- Hits         2789     2788       -1     
  Misses       3260     3260              
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@KnorpelSenf KnorpelSenf mentioned this pull request Apr 1, 2024
Copy link

@kolay-v kolay-v left a comment

Choose a reason for hiding this comment

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

pq is nice

@KnorpelSenf KnorpelSenf merged commit c89732d into main Apr 1, 2024
8 checks passed
@KnorpelSenf KnorpelSenf deleted the avoid-mapped-type branch April 1, 2024 20:26
@KnorpelSenf
Copy link
Member Author

@all-contributors add @kolay-v for review

Copy link
Contributor

@KnorpelSenf

@kolay-v already contributed before to review

@KnorpelSenf
Copy link
Member Author

Oh

@KnorpelSenf
Copy link
Member Author

Awesome

if (ctx.callbackQuery) {
const s: string = ctx.update.callback_query.data;
assert(s);
throw "never";
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps you could replace this and other instances of it with https://deno.land/std@0.224.0/assert/unreachable.ts.

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.

(bug) memory leak
3 participants