Skip to content

docs(cookie): add JSDoc for serialize function and SerializeOptions#495

Open
Vansh1811 wants to merge 1 commit into
tinyhttp:masterfrom
Vansh1811:fix/cookie-serialize-jsdoc
Open

docs(cookie): add JSDoc for serialize function and SerializeOptions#495
Vansh1811 wants to merge 1 commit into
tinyhttp:masterfrom
Vansh1811:fix/cookie-serialize-jsdoc

Conversation

@Vansh1811
Copy link
Copy Markdown

Summary

Fixes #492

The serialize function and SerializeOptions type are part of the public API but lacked JSDoc comments. This PR adds comprehensive inline documentation to improve the IDE developer experience.

Changes

  • Added JSDoc to the SerializeOptions type with individual field descriptions (including RFC links for maxAge, domain, path, httpOnly, secure, sameSite, expires)
  • Added full JSDoc to the serialize() function including:
    • @param for all parameters
    • @returns description
    • @throws for TypeError cases
    • @example block showing real-world usage

Before vs After

Before: SerializeOptions fields showed no hover info in IDE. serialize() had no documentation.

After: All fields are documented with descriptions and RFC links. Users get inline help for every option.

Testing

No logic changes — this is documentation-only. Existing tests pass without modification.

Fixes tinyhttp#492 - The serialize function and SerializeOptions type are part
of the public API but lacked JSDoc comments. This degrades IDE DX since
users don't get inline help for cookie fields like sameSite, secure, etc.

Added comprehensive JSDoc documentation for:
- SerializeOptions type with descriptions for each field
- serialize() function with parameter and return type docs
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.

docs(cookie): missing jsdoc for serialize function and serializeoptions

1 participant