diff --git a/types/cookies/cookies-tests.ts b/types/cookies/cookies-tests.ts index cd46e0987b..094357e093 100644 --- a/types/cookies/cookies-tests.ts +++ b/types/cookies/cookies-tests.ts @@ -10,9 +10,9 @@ const server = http.createServer((req, res) => { new Cookies(req, res, {keys: new Keygrip([])}); new Cookies(req, res, {secure: true}); - let unsigned: string; - let signed: string; - let tampered: string; + let unsigned: string | undefined; + let signed: string | undefined; + let tampered: string | undefined; if (req.url === "/set") { cookies diff --git a/types/cookies/index.d.ts b/types/cookies/index.d.ts index 380ce03b7d..eef7bbdc80 100644 --- a/types/cookies/index.d.ts +++ b/types/cookies/index.d.ts @@ -22,7 +22,7 @@ interface Cookies { * Cookie header in the request. If such a cookie exists, * its value is returned. Otherwise, nothing is returned. */ - get(name: string, opts?: Cookies.GetOption): string; + get(name: string, opts?: Cookies.GetOption): string | undefined; /** * This sets the given cookie in the response and returns diff --git a/types/cookies/tsconfig.json b/types/cookies/tsconfig.json index d7a17c23bc..7e8eec6736 100644 --- a/types/cookies/tsconfig.json +++ b/types/cookies/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "index.d.ts", "cookies-tests.ts" ] -} \ No newline at end of file +}