Skip to content

Commit b70b8e2

Browse files
authored
Add undefined to optional properties, Body to Connect (DefinitelyTyped#54315)
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 body-parser -- connect-redis microsoft/dtslint#335
1 parent 11dccd7 commit b70b8e2

File tree

109 files changed

+2873
-2864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+2873
-2864
lines changed

types/body-parser/index.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ declare function bodyParser(
2424
declare namespace bodyParser {
2525
interface Options {
2626
/** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */
27-
inflate?: boolean;
27+
inflate?: boolean | undefined;
2828
/**
2929
* Controls the maximum request body size. If this is a number,
3030
* then the value specifies the number of bytes; if it is a string,
3131
* the value is passed to the bytes library for parsing. Defaults to '100kb'.
3232
*/
33-
limit?: number | string;
33+
limit?: number | string | undefined;
3434
/**
3535
* The type option is used to determine what media type the middleware will parse
3636
*/
37-
type?: string | string[] | ((req: http.IncomingMessage) => any);
37+
type?: string | string[] | ((req: http.IncomingMessage) => any) | undefined;
3838
/**
3939
* The verify option, if supplied, is called as verify(req, res, buf, encoding),
4040
* where buf is a Buffer of the raw request body and encoding is the encoding of the request.
@@ -52,7 +52,7 @@ declare namespace bodyParser {
5252
* When set to `true`, will only accept arrays and objects;
5353
* when `false` will accept anything JSON.parse accepts. Defaults to `true`.
5454
*/
55-
strict?: boolean;
55+
strict?: boolean | undefined;
5656
}
5757

5858
interface OptionsText extends Options {
@@ -61,21 +61,21 @@ declare namespace bodyParser {
6161
* is not specified in the Content-Type header of the request.
6262
* Defaults to `utf-8`.
6363
*/
64-
defaultCharset?: string;
64+
defaultCharset?: string | undefined;
6565
}
6666

6767
interface OptionsUrlencoded extends Options {
6868
/**
6969
* The extended option allows to choose between parsing the URL-encoded data
7070
* with the querystring library (when `false`) or the qs library (when `true`).
7171
*/
72-
extended?: boolean;
72+
extended?: boolean | undefined;
7373
/**
7474
* The parameterLimit option controls the maximum number of parameters
7575
* that are allowed in the URL-encoded data. If a request contains more parameters than this value,
7676
* a 413 will be returned to the client. Defaults to 1000.
7777
*/
78-
parameterLimit?: number;
78+
parameterLimit?: number | undefined;
7979
}
8080

8181
/**

types/body-scroll-lock/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
55

66
export interface BodyScrollOptions {
7-
reserveScrollBarGap?: boolean;
8-
allowTouchMove?: (el: HTMLElement | Element) => void;
7+
reserveScrollBarGap?: boolean | undefined;
8+
allowTouchMove?: ((el: HTMLElement | Element) => void) | undefined;
99
}
1010

1111
export function disableBodyScroll(targetElement: HTMLElement | Element, options?: BodyScrollOptions): void;

types/bonjour/index.d.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ declare namespace bonjour {
3535
removeAllListeners(event?: 'up' | 'down'): this;
3636
}
3737
interface BrowserOptions {
38-
type?: string;
39-
subtypes?: string[];
40-
protocol?: string;
41-
txt?: { [key: string]: string };
38+
type?: string | undefined;
39+
subtypes?: string[] | undefined;
40+
protocol?: string | undefined;
41+
txt?: { [key: string]: string } | undefined;
4242
}
4343

4444
interface ServiceOptions {
4545
name: string;
46-
host?: string;
46+
host?: string | undefined;
4747
port: number;
4848
type: string;
49-
subtypes?: string[];
50-
protocol?: 'udp'|'tcp';
51-
txt?: { [key: string]: string };
52-
probe?: boolean;
49+
subtypes?: string[] | undefined;
50+
protocol?: 'udp'|'tcp' | undefined;
51+
txt?: { [key: string]: string } | undefined;
52+
probe?: boolean | undefined;
5353
}
5454

5555
interface BaseService {
@@ -75,14 +75,14 @@ declare namespace bonjour {
7575
start(): void;
7676
}
7777
interface BonjourOptions {
78-
type?: 'udp4' | 'udp6';
79-
multicast?: boolean;
80-
interface?: string;
81-
port?: number;
82-
ip?: string;
83-
ttl?: number;
84-
loopback?: boolean;
85-
reuseAddr?: boolean;
78+
type?: 'udp4' | 'udp6' | undefined;
79+
multicast?: boolean | undefined;
80+
interface?: string | undefined;
81+
port?: number | undefined;
82+
ip?: string | undefined;
83+
ttl?: number | undefined;
84+
loopback?: boolean | undefined;
85+
reuseAddr?: boolean | undefined;
8686
}
8787
interface Bonjour {
8888
(opts?: BonjourOptions): Bonjour;

types/boom/index.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,28 @@ declare class Boom<Data = any> extends Error {
3333
* isMissing will be true on the error object." mentioned in
3434
* @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes}
3535
*/
36-
isMissing?: boolean;
36+
isMissing?: boolean | undefined;
3737
/** https://github.com/hapijs/boom#createstatuscode-message-data and https://github.com/hapijs/boom/blob/v4.3.0/lib/index.js#L99 */
3838
data: Data;
3939
}
4040
declare namespace Boom {
4141
interface Options<Data> {
4242
/** statusCode - the HTTP status code. Defaults to 500 if no status code is already set. */
43-
statusCode?: number;
43+
statusCode?: number | undefined;
4444
/** data - additional error information (assigned to error.data). */
45-
data?: Data;
45+
data?: Data | undefined;
4646
/** decorate - an option with extra properties to set on the error object. */
47-
decorate?: object;
47+
decorate?: object | undefined;
4848
/** ctor - constructor reference used to crop the exception call stack output. */
4949
ctor?: any;
5050
/** message - error message string. If the error already has a message, the provided message is added as a prefix. Defaults to no message. */
51-
message?: string;
51+
message?: string | undefined;
5252
/**
5353
* override - if false, the err provided is a Boom object, and a statusCode or message are
5454
* provided, the values are ignored. Defaults to true (apply the provided statusCode and
5555
* message options to the error regardless of its type, Error or Boom object).
5656
*/
57-
override?: boolean;
57+
override?: boolean | undefined;
5858
}
5959

6060
interface Output {
@@ -96,7 +96,7 @@ declare namespace Boom {
9696
* @param options optional additional options
9797
* @see {@link https://github.com/hapijs/boom#boomifyerror-options}
9898
*/
99-
function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): Boom<null>;
99+
function boomify(error: Error, options?: { statusCode?: number | undefined, message?: string | undefined, override?: boolean | undefined }): Boom<null>;
100100

101101
/**
102102
* Identifies whether an error is a Boom object. Same as calling instanceof Boom.

types/boom/v4/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ declare namespace Boom {
2727
/** reformat() - rebuilds error.output using the other object properties. */
2828
reformat: () => string;
2929
/** "If message is unset, the 'error' segment of the header will not be present and isMissing will be true on the error object." mentioned in @see {@link https://github.com/hapijs/boom#boomunauthorizedmessage-scheme-attributes} */
30-
isMissing?: boolean;
30+
isMissing?: boolean | undefined;
3131
/** https://github.com/hapijs/boom#createstatuscode-message-data and https://github.com/hapijs/boom/blob/v4.3.0/lib/index.js#L99 */
3232
data: Data;
3333
}
@@ -63,7 +63,7 @@ declare namespace Boom {
6363
* @param options optional additional options
6464
* @see {@link https://github.com/hapijs/boom#boomifyerror-options}
6565
*/
66-
export function boomify(error: Error, options?: { statusCode?: number, message?: string, override?: boolean }): BoomError<null>;
66+
export function boomify(error: Error, options?: { statusCode?: number | undefined, message?: string | undefined, override?: boolean | undefined }): BoomError<null>;
6767

6868
/**
6969
* Decorates an error with the boom properties

types/bootstrap/js/dist/tooltip.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ declare namespace Tooltip {
281281
*
282282
* @default ''
283283
*/
284-
customClass?: string | (() => string);
284+
customClass?: string | (() => string) | undefined;
285285

286286
/**
287287
* Enable or disable the sanitization. If activated 'template' and

0 commit comments

Comments
 (0)