mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 01:00:05 +00:00
[cookies] fix Cookies.get return type (#34860)
* [cookies] fix Cookies.get return type If not exists cookie, return undefined. * fix tests
This commit is contained in:
@@ -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
|
||||
|
||||
2
types/cookies/index.d.ts
vendored
2
types/cookies/index.d.ts
vendored
@@ -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
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user