Skip to content

Commit cd29f1c

Browse files
authored
Add undefined to optional properties, Karma to Mimos (DefinitelyTyped#54323)
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 karma-chrome-launcher -- mimos microsoft/dtslint#335
1 parent 92af6ad commit cd29f1c

File tree

91 files changed

+3384
-3385
lines changed

Some content is hidden

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

91 files changed

+3384
-3385
lines changed

types/karma-chrome-launcher/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ declare module 'karma' {
1414
* One reason to do this is to have a permanent Chrome user data directory inside the project directory
1515
* to be able to install plugins there (e.g. JetBrains IDE Support plugin).
1616
*/
17-
chromeDataDir?: string;
17+
chromeDataDir?: string | undefined;
1818
}
1919
}

types/karma-coverage-istanbul-reporter/index.d.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,56 @@
66

77
export interface Threshold {
88
/** @default 0 */
9-
readonly statements?: number;
9+
readonly statements?: number | undefined;
1010

1111
/** @default 0 */
12-
readonly lines?: number;
12+
readonly lines?: number | undefined;
1313

1414
/** @default 0 */
15-
readonly branches?: number;
15+
readonly branches?: number | undefined;
1616

1717
/** @default 0 */
18-
readonly functions?: number;
18+
readonly functions?: number | undefined;
1919
}
2020

2121
export interface ThresholdsEach extends Threshold {
2222
/** @default {} */
23-
readonly overrides?: { [key: string]: Threshold };
23+
readonly overrides?: { [key: string]: Threshold } | undefined;
2424
}
2525

2626
export interface ThresholdConfig {
2727
/**
2828
* Set to `true` to not fail the test command when thresholds are not met.
2929
* @default false
3030
*/
31-
readonly emitWarning?: boolean;
31+
readonly emitWarning?: boolean | undefined;
3232

3333
/** Thresholds for all files. */
34-
readonly global?: Threshold;
34+
readonly global?: Threshold | undefined;
3535

3636
/** Thresholds per file. */
37-
readonly each?: ThresholdsEach;
37+
readonly each?: ThresholdsEach | undefined;
3838
}
3939

4040
/** @see {@link https://github.com/mattlewis92/karma-coverage-istanbul-reporter#configuration} */
4141
export interface CoverageIstanbulReporter {
4242
/** Reports can be any that are listed {@link https://github.com/istanbuljs/istanbuljs/tree/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-reports/lib here}. */
43-
readonly reports?: string[];
43+
readonly reports?: string[] | undefined;
4444

4545
/**
4646
* Base output directory.
4747
* If you include `%browser%` in the path it will be replaced with the karma browser name.
4848
*/
49-
readonly dir?: string;
49+
readonly dir?: string | undefined;
5050

5151
/** Combines coverage information from multiple browsers into one report rather than outputting a report for each browser */
52-
readonly combineBrowserReports?: boolean;
52+
readonly combineBrowserReports?: boolean | undefined;
5353

5454
/** if using webpack and pre-loaders, work around webpack breaking the source path. */
55-
readonly fixWebpackSourcePaths?: boolean;
55+
readonly fixWebpackSourcePaths?: boolean | undefined;
5656

5757
/** Omit files with no statements, no functions and no branches from the report. */
58-
readonly skipFilesWithNoCoverage?: boolean;
58+
readonly skipFilesWithNoCoverage?: boolean | undefined;
5959

6060
// TODO: Add istanbul-api
6161
/** Most reporters accept additional config options. You can pass these through the `report-config` option. */
@@ -65,10 +65,10 @@ export interface CoverageIstanbulReporter {
6565
* Enforce percentage thresholds.
6666
* Anything under these percentages will cause karma to fail with an exit code of 1 if not running in watch mode.
6767
*/
68-
readonly thresholds?: ThresholdConfig;
68+
readonly thresholds?: ThresholdConfig | undefined;
6969

7070
/** Output config used by istanbul for debugging. */
71-
readonly verbose?: boolean;
71+
readonly verbose?: boolean | undefined;
7272

7373
// TODO: Add istanbul-api
7474
/** `instrumentation` is used to configure Istanbul API package. */
@@ -78,6 +78,6 @@ export interface CoverageIstanbulReporter {
7878
declare module 'karma' {
7979
interface ConfigOptions {
8080
/** {@link https://github.com/istanbuljs/istanbuljs/blob/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-api/lib/config.js#L33-L39 Any of these options are valid}. */
81-
readonly coverageIstanbulReporter?: CoverageIstanbulReporter;
81+
readonly coverageIstanbulReporter?: CoverageIstanbulReporter | undefined;
8282
}
8383
}

types/karma-coverage/index.d.ts

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ declare module "karma" {
1313
/**
1414
* {@link https://github.com/karma-runner/karma-coverage/blob/v1.1.2/docs/configuration.md }
1515
*/
16-
coverageReporter?: KarmaCoverageReporter & { reporters?: KarmaCoverageReporter[] };
16+
coverageReporter?: KarmaCoverageReporter & { reporters?: KarmaCoverageReporter[] | undefined } | undefined;
1717
}
1818

1919
/** Reporter type */
@@ -32,80 +32,80 @@ declare module "karma" {
3232

3333
interface Reporter {
3434
type: ReporterType;
35-
dir?: string;
36-
subdir?: string | ((browser: string) => string);
37-
file?: string;
35+
dir?: string | undefined;
36+
subdir?: string | ((browser: string) => string) | undefined;
37+
file?: string | undefined;
3838
}
3939

4040
interface CheckTresholds {
41-
global?: Tresholds;
42-
each?: Tresholds;
41+
global?: Tresholds | undefined;
42+
each?: Tresholds | undefined;
4343
}
4444

4545
interface Tresholds {
46-
statements?: number;
47-
branches?: number;
48-
functions?: number;
49-
lines?: number;
50-
excludes?: string[];
51-
overrides?: Record<string, Tresholds>;
46+
statements?: number | undefined;
47+
branches?: number | undefined;
48+
functions?: number | undefined;
49+
lines?: number | undefined;
50+
excludes?: string[] | undefined;
51+
overrides?: Record<string, Tresholds> | undefined;
5252
}
5353

5454
interface Watermarks {
55-
statements?: [number, number];
56-
functions?: [number, number];
57-
branches?: [number, number];
58-
lines?: [number, number];
55+
statements?: [number, number] | undefined;
56+
functions?: [number, number] | undefined;
57+
branches?: [number, number] | undefined;
58+
lines?: [number, number] | undefined;
5959
}
6060

6161
interface KarmaCoverageReporter {
6262
/** Specify a reporter type */
63-
type?: ReporterType;
63+
type?: ReporterType | undefined;
6464

6565
/** This will be used to output coverage reports. When you set a relative path, the directory is resolved against the basePath. */
66-
dir?: string;
66+
dir?: string | undefined;
6767

6868
/** This will be used in complement of the coverageReporter.dir option to generate the full output directory path */
69-
subdir?: string | ((browser: string) => string);
69+
subdir?: string | ((browser: string) => string) | undefined;
7070

7171
/** If you use one of these reporters, `cobertura`, `lcovonly`, `teamcity`, `text` or `text-summary`, you may set the file option to specify the output file */
72-
file?: string;
72+
file?: string | undefined;
7373

7474
/** This will be used to configure minimum threshold enforcement for coverage results */
75-
check?: CheckTresholds;
75+
check?: CheckTresholds | undefined;
7676

7777
/** This will be used to set the coverage threshold colors */
78-
watermarks?: Watermarks;
78+
watermarks?: Watermarks | undefined;
7979
/**
8080
* You can opt to include all sources files, as indicated by the coverage preprocessor,
8181
* in your code coverage data, even if there are no tests covering them
8282
*/
83-
includeAllSources?: boolean;
83+
includeAllSources?: boolean | undefined;
8484

8585
/** You can opt to specify a source store allowing for external coverage collectors access to the instrumented code. */
86-
sourceStore?: Store;
86+
sourceStore?: Store | undefined;
8787

8888
/** You can use multiple reporters, by providing array of options */
89-
reporters?: Reporter[];
89+
reporters?: Reporter[] | undefined;
9090
/**
9191
* Karma-coverage can infers the instrumenter regarding of the file extension.
9292
* It is possible to override this behavior and point out an instrumenter
9393
* for the files matching a specific pattern.
9494
*/
9595
instrumenter?: {
9696
[key: string]: string;
97-
};
97+
} | undefined;
9898

99-
instrumenters?: Record<string, any>;
99+
instrumenters?: Record<string, any> | undefined;
100100

101-
instrumenterOptions?: Record<string, Record<string, unknown>>;
101+
instrumenterOptions?: Record<string, Record<string, unknown>> | undefined;
102102

103103
/**
104104
* If set to true, then CoffeeScript files instrumented with Ibrik will use
105105
* the .js extension for the transpiled source (without this option,
106106
* the JavaScript files will keep the original .coffee extension)
107107
*/
108-
useJSExtensionForCoffeeScript?: boolean;
108+
useJSExtensionForCoffeeScript?: boolean | undefined;
109109

110110
[moreSettings: string]: unknown;
111111
}

types/karma-jasmine-html-reporter/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ declare module 'karma' {
1313
* because it's already handled by another reporter
1414
* See {@link https://github.com/dfederm/karma-jasmine-html-reporter#with-options}
1515
*/
16-
jasmineHtmlReporter?: JasmineHtmlReporterOptions;
16+
jasmineHtmlReporter?: JasmineHtmlReporterOptions | undefined;
1717
}
1818
interface JasmineHtmlReporterOptions {
1919
/**
2020
* Suppress all messages (overrides other suppress settings)
2121
*/
22-
suppressAll?: boolean;
22+
suppressAll?: boolean | undefined;
2323
/** Suppress failed messages */
24-
suppressFailed?: boolean;
24+
suppressFailed?: boolean | undefined;
2525
}
2626
}

types/karma-jasmine/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ declare module 'karma' {
1212
interface ClientOptions {
1313
jasmine?: jasmine.EnvConfiguration & {
1414
/** @deprecated undocumented to be removed */
15-
timeoutInterval?: number;
16-
};
15+
timeoutInterval?: number | undefined;
16+
} | undefined;
1717
/**
1818
* run a subset of the full set of specs.
1919
* Complete sharding support needs to be done in the process that calls karma,
2020
* and would need to support test result integration across shards.
2121
* See {@link https://github.com/karma-runner/karma-jasmine#sharding}
2222
*
2323
*/
24-
shardIndex?: number;
24+
shardIndex?: number | undefined;
2525
/**
2626
* run a subset of the full set of specs.
2727
* Complete sharding support needs to be done in the process that calls karma,
2828
* and would need to support test result integration across shards.
2929
* See {@link https://github.com/karma-runner/karma-jasmine#sharding}
3030
*/
31-
totalShards?: number;
31+
totalShards?: number | undefined;
3232
}
3333
}

0 commit comments

Comments
 (0)