ITADN

Runtime and TS types of getCookies are wrong (still)

#7053OpenIonaru 创建于 2026-03-18
bugneeds triage
I
Ionarucommented
**Describe the bug** The `getCookies` function returns the type `Record<string, string>`, telling Typescript that any value within the result is a `string`. Related: https://github.com/denoland/std/issues/6852 **Steps to Reproduce** ```ts const cookieValue = getCookies(new Headers([['cookie', 'key=val']])).someOtherCookie // cookieValue is undefined here, but Typescript thinks it's a string. ``` **Expected behavior** ```ts const cookieValue = getCookies(new Headers([['cookie', 'key=val']])).someOtherCookie // Typescript correctly knows that cookieValue can be undefined. (string | undefined) ``` **Environment** <!-- please complete the following information --> - OS: Windows 11 - deno version: 2.7.5 - std version: @std/http 1.0.25
3 条评论