Skip to content

fix(types): correct deleteCookie attributes#5461

Open
Ram-blip wants to merge 1 commit into
nodejs:mainfrom
Ram-blip:fix/delete-cookie-attributes-path-type
Open

fix(types): correct deleteCookie attributes#5461
Ram-blip wants to merge 1 commit into
nodejs:mainfrom
Ram-blip:fix/delete-cookie-attributes-path-type

Conversation

@Ram-blip

Copy link
Copy Markdown

This relates to...

Fixes #5458

Rationale

deleteCookie(headers, name, attributes) supports path and domain at runtime for deleting path-scoped cookies, but the TypeScript declaration currently exposes the attributes object as { name?: string, domain?: string }.

This causes TypeScript to reject valid usage with path, while accepting name even though the cookie name is already provided as the second positional argument.

Changes

Updates the deleteCookie TypeScript declaration from:

{ name?: string, domain?: string }

to:

{ path?: string, domain?: string }

Adds tsd coverage to verify that:

  • path and domain are accepted as delete-cookie attributes
  • name is rejected inside the attributes object

Features

N/A

Bug Fixes

Fixes the deleteCookie TypeScript declaration so it matches runtime behavior and documentation.

Breaking Changes and Deprecations

N/A

Status

Signed-off-by: Ram-blip <ramcruze2000@gmail.com>

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.47%. Comparing base (667d8a3) to head (7f3d2cc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5461      +/-   ##
==========================================
- Coverage   93.48%   93.47%   -0.02%     
==========================================
  Files         110      110              
  Lines       37115    37115              
==========================================
- Hits        34697    34693       -4     
- Misses       2418     2422       +4     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

deleteCookie TypeScript attributes expose name instead of path

3 participants