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(http): have getCookies() return Record<string, string | undefined> #5996

Closed
wants to merge 1 commit into from

Conversation

canac
Copy link
Contributor

@canac canac commented Sep 17, 2024

Make the return type of getCookies Record<string, string | undefined> so that TypeScript will force you to check that the cookie is actually present before using it.

Note that this is not a breaking code change, but it is a breaking type change, i.e. code that used to type check successfully may not anymore after updating to a version that includes this change.

Fixes #5979

Make the return type Record<string, string | undefined> so that
TypeScript will force you to check that the cookie is actually present.

Fixes denoland#5979
@canac canac requested a review from kt3k as a code owner September 17, 2024 00:23
@github-actions github-actions bot added the http label Sep 17, 2024
Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.29%. Comparing base (381d70d) to head (19162bd).
Report is 17 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5996   +/-   ##
=======================================
  Coverage   96.29%   96.29%           
=======================================
  Files         493      493           
  Lines       39530    39531    +1     
  Branches     5833     5834    +1     
=======================================
+ Hits        38065    38066    +1     
  Misses       1423     1423           
  Partials       42       42           

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

@iuioiua iuioiua changed the title fix(http): fix getCookies return type fix(http): have getCookies() return Record<string, string | undefined> Sep 17, 2024
Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

@iuioiua iuioiua closed this Sep 19, 2024
@canac canac deleted the get-cookies-return-type branch September 19, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Return type of http/getCookies is Record<string, string> instead of Record<string, string | undefined>
2 participants