Skip to content

Commit 1c5c954

Browse files
authored
chore: improve jsdoc in cookies (#3478)
1 parent d5c9c05 commit 1c5c954

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

lib/web/cookies/index.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ const { Headers } = require('../fetch/headers')
99
* @typedef {Object} Cookie
1010
* @property {string} name
1111
* @property {string} value
12-
* @property {Date|number|undefined} expires
13-
* @property {number|undefined} maxAge
14-
* @property {string|undefined} domain
15-
* @property {string|undefined} path
16-
* @property {boolean|undefined} secure
17-
* @property {boolean|undefined} httpOnly
18-
* @property {'Strict'|'Lax'|'None'} sameSite
19-
* @property {string[]} unparsed
12+
* @property {Date|number} [expires]
13+
* @property {number} [maxAge]
14+
* @property {string} [domain]
15+
* @property {string} [path]
16+
* @property {boolean} [secure]
17+
* @property {boolean} [httpOnly]
18+
* @property {'Strict'|'Lax'|'None'} [sameSite]
19+
* @property {string[]} [unparsed]
2020
*/
2121

2222
/**
@@ -29,6 +29,8 @@ function getCookies (headers) {
2929
webidl.brandCheck(headers, Headers, { strict: false })
3030

3131
const cookie = headers.get('cookie')
32+
33+
/** @type {Record<string, string>} */
3234
const out = {}
3335

3436
if (!cookie) {

lib/web/cookies/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const assert = require('node:assert')
99
* @description Parses the field-value attributes of a set-cookie header string.
1010
* @see https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis#section-5.4
1111
* @param {string} header
12-
* @returns if the header is invalid, null will be returned
12+
* @returns {import('./index').Cookie|null} if the header is invalid, null will be returned
1313
*/
1414
function parseSetCookie (header) {
1515
// 1. If the set-cookie-string contains a %x00-08 / %x0A-1F / %x7F

0 commit comments

Comments
 (0)