Skip to content

Commit 92af6ad

Browse files
authored
Add undefined to optional properties, Hex to Jws (DefinitelyTyped#54322)
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 hex-color-regex -- jws microsoft/dtslint#335
1 parent d444f9f commit 92af6ad

File tree

95 files changed

+2275
-2275
lines changed

Some content is hidden

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

95 files changed

+2275
-2275
lines changed

types/hex-color-regex/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ declare function hexColorRegex(opts?: hexColorRegex.Options): RegExp;
1111

1212
declare namespace hexColorRegex {
1313
interface Options {
14-
strict?: boolean;
14+
strict?: boolean | undefined;
1515
}
1616
}
1717

types/history/createBrowserHistory.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { History, LocationState } from './index';
22
import { getConfirmation } from './DOMUtils';
33

44
export interface BrowserHistoryBuildOptions {
5-
basename?: string;
6-
forceRefresh?: boolean;
7-
getUserConfirmation?: typeof getConfirmation;
8-
keyLength?: number;
5+
basename?: string | undefined;
6+
forceRefresh?: boolean | undefined;
7+
getUserConfirmation?: typeof getConfirmation | undefined;
8+
keyLength?: number | undefined;
99
}
1010

1111
export default function createBrowserHistory<S = LocationState>(options?: BrowserHistoryBuildOptions): History<S>;

types/history/createHashHistory.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { getConfirmation } from './DOMUtils';
44
export type HashType = 'hashbang' | 'noslash' | 'slash';
55

66
export interface HashHistoryBuildOptions {
7-
basename?: string;
8-
hashType?: HashType;
9-
getUserConfirmation?: typeof getConfirmation;
7+
basename?: string | undefined;
8+
hashType?: HashType | undefined;
9+
getUserConfirmation?: typeof getConfirmation | undefined;
1010
}
1111

1212
export default function createHashHistory<S = LocationState>(options?: HashHistoryBuildOptions): History<S>;

types/history/createMemoryHistory.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { History, Location, LocationState } from './index';
22
import { getConfirmation } from './DOMUtils';
33

44
export interface MemoryHistoryBuildOptions {
5-
getUserConfirmation?: typeof getConfirmation;
6-
initialEntries?: string[];
7-
initialIndex?: number;
8-
keyLength?: number;
5+
getUserConfirmation?: typeof getConfirmation | undefined;
6+
initialEntries?: string[] | undefined;
7+
initialIndex?: number | undefined;
8+
keyLength?: number | undefined;
99
}
1010

1111
export interface MemoryHistory<HistoryLocationState = LocationState> extends History<HistoryLocationState> {

types/history/index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ export interface Location<S = LocationState> {
2929
search: Search;
3030
state: S;
3131
hash: Hash;
32-
key?: LocationKey;
32+
key?: LocationKey | undefined;
3333
}
3434

3535
export interface LocationDescriptorObject<S = LocationState> {
36-
pathname?: Pathname;
37-
search?: Search;
38-
state?: S;
39-
hash?: Hash;
40-
key?: LocationKey;
36+
pathname?: Pathname | undefined;
37+
search?: Search | undefined;
38+
state?: S | undefined;
39+
hash?: Hash | undefined;
40+
key?: LocationKey | undefined;
4141
}
4242

4343
export namespace History {

types/history/v2/index.d.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ export interface History {
4040
}
4141

4242
export type HistoryOptions = {
43-
getCurrentLocation?: () => Location;
44-
finishTransition?: (nextLocation: Location) => boolean;
45-
saveState?: (key: LocationKey, state: LocationState) => void;
46-
go?: (n: number) => void;
47-
getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void;
48-
keyLength?: number;
49-
queryKey?: string | boolean;
50-
stringifyQuery?: (obj: any) => string;
51-
parseQueryString?: (str: string) => any;
52-
basename?: string;
53-
entries?: string | [any];
54-
current?: number;
43+
getCurrentLocation?: (() => Location) | undefined;
44+
finishTransition?: ((nextLocation: Location) => boolean) | undefined;
45+
saveState?: ((key: LocationKey, state: LocationState) => void) | undefined;
46+
go?: ((n: number) => void) | undefined;
47+
getUserConfirmation?: ((message: string, callback: (result: boolean) => void) => void) | undefined;
48+
keyLength?: number | undefined;
49+
queryKey?: string | boolean | undefined;
50+
stringifyQuery?: ((obj: any) => string) | undefined;
51+
parseQueryString?: ((str: string) => any) | undefined;
52+
basename?: string | undefined;
53+
entries?: string | [any] | undefined;
54+
current?: number | undefined;
5555
}
5656

5757
export type Location = {
@@ -61,14 +61,14 @@ export type Location = {
6161
state: LocationState;
6262
action: Action;
6363
key: LocationKey;
64-
basename?: string;
64+
basename?: string | undefined;
6565
};
6666

6767
export type LocationDescriptorObject = {
68-
pathname?: Pathname;
69-
search?: Search;
70-
query?: Query;
71-
state?: LocationState;
68+
pathname?: Pathname | undefined;
69+
search?: Search | undefined;
70+
query?: Query | undefined;
71+
state?: LocationState | undefined;
7272
};
7373

7474
export namespace History {

types/history/v3/index.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export interface History<Q = DefaultQuery, QL = DefaultQueryLike> {
2828
}
2929

3030
export interface HistoryOptions {
31-
getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void;
32-
keyLength?: number;
31+
getUserConfirmation?: ((message: string, callback: (result: boolean) => void) => void) | undefined;
32+
keyLength?: number | undefined;
3333
}
3434

3535
export type Hash = string;
@@ -46,11 +46,11 @@ export interface Location<Q = DefaultQuery> {
4646
}
4747

4848
export interface LocationDescriptorObject {
49-
pathname?: Pathname;
50-
search?: Search;
51-
query?: QueryLike;
52-
hash?: Hash;
53-
state?: LocationState;
49+
pathname?: Pathname | undefined;
50+
search?: Search | undefined;
51+
query?: QueryLike | undefined;
52+
hash?: Hash | undefined;
53+
state?: LocationState | undefined;
5454
}
5555

5656
export type LocationDescriptor = LocationDescriptorObject | Path;

types/history/v3/lib/createMemoryHistory.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { CreateHistory, History } from "history";
22

33
export interface MemoryHistoryOptions {
4-
entries?: string | [string];
5-
current?: string;
4+
entries?: string | [string] | undefined;
5+
current?: string | undefined;
66
}
77

88
export interface MemoryHistory {

types/history/v3/lib/useBasename.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { CreateHistory, HistoryOptions } from "history";
33
export type Basename = string;
44

55
export interface HistoryBasenameOptions {
6-
basename?: Basename;
6+
basename?: Basename | undefined;
77
}
88

99
export interface HistoryBasename {
10-
basename?: Basename;
10+
basename?: Basename | undefined;
1111
}
1212

1313
export default function useBasename<O, H>(createHistory: CreateHistory<O, H>): CreateHistory<O & HistoryBasenameOptions, H & HistoryBasename>;

types/hoek/index.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55

66
export interface ContainOptions {
77
/** Perform a deep comparison of the values? */
8-
deep?: boolean;
8+
deep?: boolean | undefined;
99
/** Allow only one occurrence of each value? */
10-
once?: boolean;
10+
once?: boolean | undefined;
1111
/** Don't allow values not explicitly listed? */
12-
only?: boolean;
12+
only?: boolean | undefined;
1313
/** Allow partial match of the values? */
14-
part?: boolean;
14+
part?: boolean | undefined;
1515
}
1616

1717
export interface ReachOptions {
1818
/** String to split chain path on. Defaults to ".". */
19-
separator?: string;
19+
separator?: string | undefined;
2020
/** Value to return if the path or value is not present. Default is undefined. */
2121
default?: any;
2222
/** Throw an error on missing member? Default is false. */
23-
strict?: boolean;
23+
strict?: boolean | undefined;
2424
/** Allow traversing functions for properties? */
25-
functions?: boolean;
25+
functions?: boolean | undefined;
2626
}
2727

2828
// Object

0 commit comments

Comments
 (0)