Skip to content

Commit 0aa2c48

Browse files
authored
Make our dts files compile when exactOptionalPropertyTypes is enabled downstream (#56489)
1 parent c266e47 commit 0aa2c48

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7403,7 +7403,7 @@ export interface CommandLineOptionBase {
74037403
isFilePath?: boolean; // True if option value is a path or fileName
74047404
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
74057405
description?: DiagnosticMessage; // The message describing what the command line switch does.
7406-
defaultValueDescription?: string | number | boolean | DiagnosticMessage; // The message describing what the dafault value is. string type is prepared for fixed chosen like "false" which do not need I18n.
7406+
defaultValueDescription?: string | number | boolean | DiagnosticMessage | undefined; // The message describing what the dafault value is. string type is prepared for fixed chosen like "false" which do not need I18n.
74077407
paramType?: DiagnosticMessage; // The name to be used for a non-boolean option's parameter
74087408
isTSConfigOnly?: boolean; // True if option can only be specified via tsconfig.json file
74097409
isCommandLineOnly?: boolean;

src/server/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ export abstract class Project implements LanguageServiceHost, ModuleResolutionHo
347347
readonly realpath?: (path: string) => string;
348348

349349
/** @internal */
350-
hasInvalidatedResolutions: HasInvalidatedResolutions | undefined;
350+
hasInvalidatedResolutions?: HasInvalidatedResolutions | undefined;
351351

352352
/** @internal */
353353
hasInvalidatedLibResolutions: HasInvalidatedLibResolutions | undefined;

src/services/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ export interface LanguageServiceHost extends GetEffectiveTypeRootsHost, MinimalR
340340
*/
341341
readDirectory?(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
342342
realpath?(path: string): string;
343-
/** @internal */ createHash?(data: string): string;
343+
/** @internal */ createHash?: ((data: string) => string) | undefined;
344344

345345
/*
346346
* Unlike `realpath and `readDirectory`, `readFile` and `fileExists` are now _required_
@@ -393,9 +393,9 @@ export interface LanguageServiceHost extends GetEffectiveTypeRootsHost, MinimalR
393393
* If provided along with custom resolveLibrary, used to determine if we should redo library resolutions
394394
* @internal
395395
*/
396-
hasInvalidatedLibResolutions?(libFileName: string): boolean;
396+
hasInvalidatedLibResolutions?: ((libFileName: string) => boolean) | undefined;
397397

398-
/** @internal */ hasInvalidatedResolutions?: HasInvalidatedResolutions;
398+
/** @internal */ hasInvalidatedResolutions?: HasInvalidatedResolutions | undefined;
399399
/** @internal */ hasChangedAutomaticTypeDirectiveNames?: HasChangedAutomaticTypeDirectiveNames;
400400
/** @internal */ getGlobalTypingsCacheLocation?(): string | undefined;
401401
/** @internal */ getSymlinkCache?(files?: readonly SourceFile[]): SymlinkCache;
@@ -432,7 +432,7 @@ export interface LanguageServiceHost extends GetEffectiveTypeRootsHost, MinimalR
432432
/** @internal */ onReleaseParsedCommandLine?(configFileName: string, oldResolvedRef: ResolvedProjectReference | undefined, optionOptions: CompilerOptions): void;
433433
/** @internal */ getIncompleteCompletionsCache?(): IncompleteCompletionsCache;
434434

435-
jsDocParsingMode?: JSDocParsingMode;
435+
jsDocParsingMode?: JSDocParsingMode | undefined;
436436
}
437437

438438
/** @internal */

tests/baselines/reference/api/typescript.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10420,7 +10420,7 @@ declare namespace ts {
1042010420
installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
1042110421
writeFile?(fileName: string, content: string): void;
1042210422
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
10423-
jsDocParsingMode?: JSDocParsingMode;
10423+
jsDocParsingMode?: JSDocParsingMode | undefined;
1042410424
}
1042510425
type WithMetadata<T> = T & {
1042610426
metadata?: unknown;

tests/cases/compiler/APILibCheck.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @noImplicitAny: true
33
// @strictNullChecks: true
44
// @lib: es2018
5+
// @exactOptionalPropertyTypes: true
56

67
// @filename: node_modules/typescript/package.json
78
{

0 commit comments

Comments
 (0)