You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add undefined to optional properties, Express to He (#54321)
In preparation for exactOptionalPropertyTypes in Typescript 4.4, add undefined to all optional properties. #no-publishing-comment
This PR covers widely used packages (more than 100,000 downloads per month) from express-rate-limit -- he.
microsoft/dtslint#335
* Enable headers for request limit (`X-RateLimit-Limit`) and current usage (`X-RateLimit-Remaining`) on all
66
66
* responses and time to wait before retrying (`Retry-After`) when `max` is exceeded. Defaults to `true`.
67
67
*/
68
-
headers?: boolean;
68
+
headers?: boolean|undefined;
69
69
70
70
/**
71
71
* Enable headers conforming to the [ratelimit standardization proposal](https://tools.ietf.org/id/draft-polli-ratelimit-headers-01.html):
72
72
* `RateLimit-Limit`, `RateLimit-Remaining`, and, if the store supports it, `RateLimit-Reset`. May be used in conjunction with, or instead of the `headers` option.
73
73
* Behavior and name will likely change in future releases.
Copy file name to clipboardExpand all lines: types/express-session/index.d.ts
+25-25Lines changed: 25 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -76,19 +76,19 @@ declare namespace session {
76
76
* then you need to separate the session cookies from each other.
77
77
* The simplest method is to simply set different names per app.
78
78
*/
79
-
name?: string;
79
+
name?: string|undefined;
80
80
81
81
/**
82
82
* The session store instance, defaults to a new `MemoryStore` instance.
83
83
* @see MemoryStore
84
84
*/
85
-
store?: Store;
85
+
store?: Store|undefined;
86
86
87
87
/**
88
88
* Settings object for the session ID cookie.
89
89
* @see CookieOptions
90
90
*/
91
-
cookie?: CookieOptions;
91
+
cookie?: CookieOptions|undefined;
92
92
93
93
/**
94
94
* Force the session identifier cookie to be set on every response. The expiration is reset to the original `maxAge`, resetting the expiration countdown.
@@ -103,7 +103,7 @@ declare namespace session {
103
103
*
104
104
* @see saveUninitialized
105
105
*/
106
-
rolling?: boolean;
106
+
rolling?: boolean|undefined;
107
107
108
108
/**
109
109
* Forces the session to be saved back to the session store, even if the session was never modified during the request.
@@ -117,7 +117,7 @@ declare namespace session {
117
117
* If it does, then you can safely set `resave: false`.
118
118
* If it does not implement the `touch` method and your store sets an expiration date on stored sessions, then you likely need `resave: true`.
119
119
*/
120
-
resave?: boolean;
120
+
resave?: boolean|undefined;
121
121
122
122
/**
123
123
* Trust the reverse proxy when setting secure cookies (via the "X-Forwarded-Proto" header).
@@ -127,7 +127,7 @@ declare namespace session {
127
127
* - `false`: All headers are ignored and the connection is considered secure only if there is a direct TLS/SSL connection.
128
128
* - `undefined`: Uses the "trust proxy" setting from express
129
129
*/
130
-
proxy?: boolean;
130
+
proxy?: boolean|undefined;
131
131
132
132
/**
133
133
* Forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified.
@@ -141,15 +141,15 @@ declare namespace session {
141
141
* Passport will add an empty Passport object to the session for use after a user is authenticated, which will be treated as a modification to the session, causing it to be saved.
142
142
* This has been fixed in PassportJS 0.3.0.
143
143
*/
144
-
saveUninitialized?: boolean;
144
+
saveUninitialized?: boolean|undefined;
145
145
146
146
/**
147
147
* Control the result of unsetting req.session (through delete, setting to null, etc.).
148
148
* - `destroy`: The session will be destroyed (deleted) when the response ends.
149
149
* - `keep`: The session in the store will be kept, but modifications made during the request are ignored and not saved.
150
150
* @default 'keep'
151
151
*/
152
-
unset?: 'destroy'|'keep';
152
+
unset?: 'destroy'|'keep'|undefined;
153
153
}
154
154
155
155
classSession{
@@ -224,9 +224,9 @@ declare namespace session {
224
224
*
225
225
* @see expires
226
226
*/
227
-
maxAge?: number;
227
+
maxAge?: number|undefined;
228
228
229
-
signed?: boolean;
229
+
signed?: boolean|undefined;
230
230
231
231
/**
232
232
* Specifies the `Date` object to be the value for the `Expires Set-Cookie` attribute.
@@ -237,27 +237,27 @@ declare namespace session {
237
237
* @deprecated The `expires` option should not be set directly; instead only use the `maxAge` option
238
238
* @see maxAge
239
239
*/
240
-
expires?: Date;
240
+
expires?: Date|undefined;
241
241
242
242
/**
243
243
* Specifies the boolean value for the `HttpOnly Set-Cookie` attribute. When truthy, the `HttpOnly` attribute is set, otherwise it is not.
244
244
* By default, the `HttpOnly` attribute is set.
245
245
*
246
246
* Be careful when setting this to `true`, as compliant clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
247
247
*/
248
-
httpOnly?: boolean;
248
+
httpOnly?: boolean|undefined;
249
249
250
250
/**
251
251
* Specifies the value for the `Path Set-Cookie` attribute.
252
252
* By default, this is set to '/', which is the root path of the domain.
253
253
*/
254
-
path?: string;
254
+
path?: string|undefined;
255
255
256
256
/**
257
257
* Specifies the value for the `Domain Set-Cookie` attribute.
258
258
* By default, no domain is set, and most clients will consider the cookie to apply to only the current domain.
259
259
*/
260
-
domain?: string;
260
+
domain?: string|undefined;
261
261
262
262
/**
263
263
* Specifies the boolean value for the `Secure Set-Cookie` attribute. When truthy, the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
@@ -275,9 +275,9 @@ declare namespace session {
275
275
*
276
276
* Please see the [README](https://github.com/expressjs/session) for an example of using secure cookies in production, but allowing for testing in development based on NODE_ENV.
277
277
*/
278
-
secure?: boolean|'auto';
278
+
secure?: boolean|'auto'|undefined;
279
279
280
-
encode?: (val: string)=>string;
280
+
encode?: ((val: string)=>string)|undefined;
281
281
282
282
/**
283
283
* Specifies the boolean or string to be the value for the `SameSite Set-Cookie` attribute.
@@ -292,21 +292,21 @@ declare namespace session {
292
292
* **Note:** This is an attribute that has not yet been fully standardized, and may change in the future.
293
293
* This also means many clients may ignore this attribute until they understand it.
0 commit comments