fix: Make enqueue_links and export_to overloads consistent with their implementations - #2225
Merged
Merged
Conversation
… implementations Since ty 0.0.74, `**kwargs: Unpack[TD]` with an open TypedDict also accepts any undeclared keyword as `object`. An implementation that types such a keyword is then not assignable to an overload that leaves it to `**kwargs`. The `EnqueueLinksFunction` overloads now name the keywords of the other mode typed `None`, which also makes `selector` and `requests` mutually exclusive for ty. `Dataset.export_to` forwards `collect_all_keys` through `**kwargs` instead of declaring it on the implementation, since only the CSV overload declares it.
1 task
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2225 +/- ##
=======================================
Coverage 93.75% 93.75%
=======================================
Files 181 181
Lines 12865 12865
=======================================
Hits 12061 12061
Misses 804 804
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Pijukatel
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bumps ty from 0.0.73 to 0.0.78 in the lock, and fixes the overloads that bump breaks.
Since ty 0.0.74,
**kwargs: Unpack[TD]over an open TypedDict is read as also accepting any undeclared keyword asobject. That extra catch-all makes an implementation which types such a keyword unassignable to an overload that leaves the keyword to**kwargs. On master, ty 0.0.78 reports 4 diagnostics: theEnqueueLinksFunctionoverloads, the assignability of theenqueue_linksimplementation to that protocol, andDataset.export_to.Each
EnqueueLinksFunctionoverload now also names the keywords of the other mode, typedNone. The implementation is assignable to both overloads again, andselectorandrequestsbecome mutually exclusive for ty as well, which mypy and pyright already enforced.Dataset.export_tono longer declarescollect_all_keyson the implementation. It flows through**kwargsinto the CSV exporter, the only one that takes it. Both overloads are unchanged.The public API is untouched: same call signatures, no renamed or added types. One runtime edge case changes.
export_to(key, 'json', collect_all_keys=True)used to ignore the flag and now raisesTypeErrorfromjson.dump, which is how every other CSV-only keyword already behaved with JSON. mypy and pyright always rejected that call.The source fix passes ty 0.0.73, 0.0.78 and 0.0.79, so it should survive the next few bumps. mypy and pyright each lose diagnostics and gain none. Once this lands, #2220 carries the rest of the lock refresh.
✍️ Drafted by Claude Code