diff --git a/packages/typescript/src/api/async/api.ts b/packages/typescript/src/api/async/api.ts index 2eac81365aae9..ef9a22be49a5e 100644 --- a/packages/typescript/src/api/async/api.ts +++ b/packages/typescript/src/api/async/api.ts @@ -218,8 +218,8 @@ export interface TranspileOptions { export interface TranspileOutput { outputText: string; - diagnostics?: readonly Diagnostic[]; - sourceMapText?: string; + diagnostics?: readonly Diagnostic[] | undefined; + sourceMapText?: string | undefined; } // @sync-only-start @@ -515,8 +515,8 @@ export class API implements FormatDiagnosticsHo const data: CreateProgramResponse = await this.client.apiRequest("createProgram", { rootFiles, createProgramOptions, - ...(oldProgram ? { oldProgram: { snapshot: oldProgram.snapshotId, project: oldProgram.getProject().id } } : {}), - ...(fileChanges ? { fileChanges } : {}), + oldProgram: oldProgram ? { snapshot: oldProgram.snapshotId, project: oldProgram.getProject().id } : undefined, + fileChanges, }); if (!data.project) { throw new Error("createProgram did not return a project"); @@ -1116,8 +1116,8 @@ export class LanguageService { project: this.project.id, file: document, position, - ...(options?.triggerCharacter !== undefined ? { triggerCharacter: options.triggerCharacter } : {}), - ...(options?.includeSymbol !== undefined ? { includeSymbol: options.includeSymbol } : {}), + triggerCharacter: options?.triggerCharacter, + includeSymbol: options?.includeSymbol, }); if (!data) return undefined; return { @@ -1324,7 +1324,7 @@ export class Program implements FormatDiagnosticsHost { const data = await this.client.apiRequest("getSyntacticDiagnostics", { snapshot: this.snapshotId, project: this.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; } @@ -1340,7 +1340,7 @@ export class Program implements FormatDiagnosticsHost { const data = await this.client.apiRequest("getBindDiagnostics", { snapshot: this.snapshotId, project: this.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; } @@ -1356,7 +1356,7 @@ export class Program implements FormatDiagnosticsHost { const data = await this.client.apiRequest("getSemanticDiagnostics", { snapshot: this.snapshotId, project: this.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; } @@ -1372,7 +1372,7 @@ export class Program implements FormatDiagnosticsHost { const data = await this.client.apiRequest("getSuggestionDiagnostics", { snapshot: this.snapshotId, project: this.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; } @@ -1388,7 +1388,7 @@ export class Program implements FormatDiagnosticsHost { const data = await this.client.apiRequest("getDeclarationDiagnostics", { snapshot: this.snapshotId, project: this.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; } @@ -1435,7 +1435,7 @@ export class Program implements FormatDiagnosticsHost { const response = await this.client.apiRequest("emit", { snapshot: this.snapshotId, project: this.project.id, - ...(emitOnly !== undefined ? { emitOnly } : {}), + emitOnly, }); const fileSystem = response.emittedFilesContents.length ? { @@ -1458,7 +1458,7 @@ export class Program implements FormatDiagnosticsHost { const response = await this.client.apiRequest("emitToString", { snapshot: this.snapshotId, project: this.project.id, - ...(emitOnly !== undefined ? { emitOnly } : {}), + emitOnly, }); return toEmitOutput(response); } @@ -1741,14 +1741,10 @@ export class Checker { project: this.project.id, name, meaning, - ...(isNode ? { location: getNodeId(location as Node) } : {}), - ...(!isNode && location - ? { - file: (location as DocumentPosition).document, - position: (location as DocumentPosition).position, - } - : {}), - ...(excludeGlobals !== undefined ? { excludeGlobals } : {}), + location: isNode ? getNodeId(location as Node) : undefined, + file: !isNode && location ? (location as DocumentPosition).document : undefined, + position: !isNode && location ? (location as DocumentPosition).position : undefined, + excludeGlobals, }); return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined; } @@ -1763,12 +1759,9 @@ export class Checker { snapshot: this.snapshotId, project: this.project.id, meaning, - ...(isNode - ? { location: getNodeId(location as Node) } - : { - file: (location as DocumentPosition).document, - position: (location as DocumentPosition).position, - }), + location: isNode ? getNodeId(location as Node) : undefined, + file: isNode ? undefined : (location as DocumentPosition).document, + position: isNode ? undefined : (location as DocumentPosition).position, }); return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : []; } @@ -1932,8 +1925,8 @@ export class Checker { snapshot: this.snapshotId, project: this.project.id, type: type.id, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (!binaryData) return undefined; return decodeNode(binaryData) as TypeNode; @@ -1945,8 +1938,8 @@ export class Checker { project: this.project.id, signature: signature.id, kind, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (!binaryData) return undefined; return decodeNode(binaryData) as Node; @@ -1957,8 +1950,8 @@ export class Checker { snapshot: this.snapshotId, project: this.project.id, type: type.id, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (typeof result !== "string") throw new TypeError("typeToString returned a non-string result"); return result; @@ -2296,9 +2289,9 @@ export class Emitter { const base64 = uint8ArrayToBase64(encoded); return this.client.apiRequest("printNode", { data: base64, - ...(options.preserveSourceNewlines !== undefined ? { preserveSourceNewlines: options.preserveSourceNewlines } : {}), - ...(options.neverAsciiEscape !== undefined ? { neverAsciiEscape: options.neverAsciiEscape } : {}), - ...(options.terminateUnterminatedLiterals !== undefined ? { terminateUnterminatedLiterals: options.terminateUnterminatedLiterals } : {}), + preserveSourceNewlines: options.preserveSourceNewlines, + neverAsciiEscape: options.neverAsciiEscape, + terminateUnterminatedLiterals: options.terminateUnterminatedLiterals, }); } } diff --git a/packages/typescript/src/api/proto.generated.ts b/packages/typescript/src/api/proto.generated.ts index b207862c5705b..0f6a952a42758 100644 --- a/packages/typescript/src/api/proto.generated.ts +++ b/packages/typescript/src/api/proto.generated.ts @@ -170,13 +170,13 @@ export interface ReleaseParams { export interface BatchRequestsParams { requests: readonly BatchRequest[] | null; - continuationToken?: string; - maxResponseBytesPerPage?: number; + continuationToken?: string | undefined; + maxResponseBytesPerPage?: number | undefined; } export interface BatchRequestsResponse { responses: BatchResponse[]; - continuationToken?: string; + continuationToken?: string | undefined; } /** InitializeResponse is returned by the initialize method. */ @@ -196,25 +196,25 @@ export interface UpdateSnapshotParams { * Snapshot, when set, requires this to be the latest active snapshot and layers * FileSystem over that snapshot's filesystem. Used by Snapshot.update. */ - snapshot?: number; + snapshot?: number | undefined; /** * OpenProjects lists tsconfig.json files to open/load in the new snapshot. * Opens are ref-counted and persist across snapshots until closed. */ - openProjects?: readonly DocumentIdentifier[]; + openProjects?: readonly DocumentIdentifier[] | undefined; /** * CloseProjects lists tsconfig.json files to release in the new snapshot. * A project is only unloaded once every API client that opened it closes it. */ - closeProjects?: readonly DocumentIdentifier[]; + closeProjects?: readonly DocumentIdentifier[] | undefined; /** FileChanges describes file system changes since the last snapshot. */ - fileChanges?: APIFileChanges; + fileChanges?: APIFileChanges | undefined; /** * FileSystem supplies file contents and directory listings for the new snapshot. * A full filesystem is canonical and total. A filesystem layer is checked * before falling back to the host filesystem. */ - fileSystem?: RequestFileSystem; + fileSystem?: RequestFileSystem | undefined; /** * OpenFiles lists files to keep open for the API client, mirroring LSP's * textDocument/didOpen. For each file, ancestor directories are searched for a @@ -223,12 +223,12 @@ export interface UpdateSnapshotParams { * inferred project (e.g. a node_modules d.ts not in any project's import graph). * Opens persist across snapshots until the file is closed. */ - openFiles?: readonly DocumentIdentifier[]; + openFiles?: readonly DocumentIdentifier[] | undefined; /** * CloseFiles lists files to release in the new snapshot. A file is only fully * closed once every API client that opened it closes it. */ - closeFiles?: readonly DocumentIdentifier[]; + closeFiles?: readonly DocumentIdentifier[] | undefined; } /** UpdateSnapshotResponse is returned by updateSnapshot. */ @@ -241,7 +241,7 @@ export interface UpdateSnapshotResponse { * Changes describes source file differences from the previous snapshot. * Nil for the first snapshot in a session. */ - changes?: SnapshotChanges; + changes?: SnapshotChanges | undefined; } /** @@ -260,8 +260,8 @@ export interface UpdateTemporarySnapshotParams { export interface CreateProgramParams { rootFiles: readonly DocumentIdentifier[] | null; createProgramOptions: CreateProgramOptions; - oldProgram?: CreateProgramOldProgramParams; - fileChanges?: APIFileChanges; + oldProgram?: CreateProgramOldProgramParams | undefined; + fileChanges?: APIFileChanges | undefined; } export interface CreateProgramResponse { @@ -276,10 +276,10 @@ export interface ParseCommandLineParams { export interface ConfigFileResponse { fileNames: string[]; options: CompilerOptions; - projectReferences?: ProjectReference[]; - typeAcquisition?: TypeAcquisition; - compileOnSave?: boolean; - raw?: unknown; + projectReferences?: ProjectReference[] | undefined; + typeAcquisition?: TypeAcquisition | undefined; + compileOnSave?: boolean | undefined; + raw?: unknown | undefined; errors: DiagnosticResponse[]; } @@ -289,13 +289,13 @@ export interface ReadConfigFileParams { export interface ReadConfigFileResponse { config: unknown; - error?: DiagnosticResponse; + error?: DiagnosticResponse | undefined; } export interface ParseJsonConfigFileContentParams { json: unknown; - configDirectory?: string; - configFileName?: DocumentIdentifier; + configDirectory?: string | undefined; + configFileName?: DocumentIdentifier | undefined; } export interface ParseConfigFileParams { @@ -309,8 +309,8 @@ export interface TranspileParams { export interface TranspileOutputResponse { outputText: string; - diagnostics?: DiagnosticResponse[]; - sourceMapText?: string; + diagnostics?: DiagnosticResponse[] | undefined; + sourceMapText?: string | undefined; } export interface TranspileFromFileParams { @@ -351,10 +351,10 @@ export interface SymbolResponse { name: string; flags: number; checkFlags: number; - declarations?: string[]; - valueDeclaration?: string; - parent?: number; - exportSymbol?: number; + declarations?: string[] | undefined; + valueDeclaration?: string | undefined; + parent?: number | undefined; + exportSymbol?: number | undefined; } export interface GetSymbolsAtPositionsParams { @@ -397,47 +397,47 @@ export interface GetTypeOfSymbolParams { export interface TypeResponse { id: number; flags: number; - objectFlags?: number; - isTupleType?: boolean; + objectFlags?: number | undefined; + isTupleType?: boolean | undefined; /** * Value is literal type data. BigInt literals are encoded as signed decimal * strings because JSON cannot represent bigint; absent values are null. */ value: unknown; /** ObjectType / TypeReference / StringMappingType / IndexType target */ - target?: number; + target?: number | undefined; /** InterfaceType type parameters */ - typeParameters?: number[]; - outerTypeParameters?: number[]; - localTypeParameters?: number[]; + typeParameters?: number[] | undefined; + outerTypeParameters?: number[] | undefined; + localTypeParameters?: number[] | undefined; /** TupleType data */ - elementFlags?: number[]; - fixedLength?: number; - readonly?: boolean; - labeledElementDeclarations?: string[]; + elementFlags?: number[] | undefined; + fixedLength?: number | undefined; + readonly?: boolean | undefined; + labeledElementDeclarations?: string[] | undefined; /** IndexedAccessType data */ - objectType?: number; - indexType?: number; + objectType?: number | undefined; + indexType?: number | undefined; /** ConditionalType data */ - checkType?: number; - extendsType?: number; + checkType?: number | undefined; + extendsType?: number | undefined; /** SubstitutionType data */ - baseType?: number; - substConstraint?: number; + baseType?: number | undefined; + substConstraint?: number | undefined; /** TemplateLiteralType text segments */ - texts?: string[]; + texts?: string[] | undefined; /** FreshableType data (LiteralType and computed enum types) */ - freshType?: number; - regularType?: number; + freshType?: number | undefined; + regularType?: number | undefined; /** TypeParameter data */ - isThisType?: boolean; + isThisType?: boolean | undefined; /** IntrinsicType data */ - intrinsicName?: string; + intrinsicName?: string | undefined; /** TypeAlias data */ - aliasTypeArguments?: number[]; - aliasSymbol?: number; + aliasTypeArguments?: number[] | undefined; + aliasSymbol?: number | undefined; /** Symbol associated with structured types */ - symbol?: number; + symbol?: number | undefined; } export interface GetTypesOfSymbolsParams { @@ -486,15 +486,15 @@ export interface ResolveNameParams { project: string; name: string; /** Optional: node handle for location context */ - location?: string; + location?: string | undefined; /** Optional: file for location context (alternative to Location) */ - file?: DocumentIdentifier; + file?: DocumentIdentifier | undefined; /** Optional: position in file for location context (with File) */ - position?: number; + position?: number | undefined; /** SymbolFlags for what kind of symbol to find */ meaning: number; /** Whether to exclude global symbols */ - excludeGlobals?: boolean; + excludeGlobals?: boolean | undefined; } /** @@ -505,11 +505,11 @@ export interface GetSymbolsInScopeParams { snapshot: number; project: string; /** Optional: node handle for location context */ - location?: string; + location?: string | undefined; /** Optional: file for location context (alternative to Location) */ - file?: DocumentIdentifier; + file?: DocumentIdentifier | undefined; /** Optional: position in file for location context (with File) */ - position?: number; + position?: number | undefined; /** SymbolFlags for what kind of symbols to find */ meaning: number; } @@ -524,11 +524,11 @@ export interface GetSignaturesOfTypeParams { export interface SignatureResponse { id: number; flags: number; - declaration?: string; - typeParameters?: number[]; - parameters?: number[]; - thisParameter?: number; - target?: number; + declaration?: string | undefined; + typeParameters?: number[] | undefined; + parameters?: number[] | undefined; + thisParameter?: number | undefined; + target?: number | undefined; } export interface GetResolvedSignatureParams { @@ -648,8 +648,8 @@ export interface TypeToTypeNodeParams { snapshot: number; project: string; type: number; - location?: string; - flags?: number; + location?: string | undefined; + flags?: number | undefined; } /** SignatureToSignatureDeclarationParams are the parameters for the signatureToSignatureDeclaration method. */ @@ -658,8 +658,8 @@ export interface SignatureToSignatureDeclarationParams { project: string; signature: number; kind: number; - location?: string; - flags?: number; + location?: string | undefined; + flags?: number | undefined; } /** CheckerSignatureParams are parameters for checker methods that operate on a signature. */ @@ -673,8 +673,8 @@ export interface CheckerSignatureParams { export interface TypePredicateResponse { kind: number; parameterIndex: number; - parameterName?: string; - type?: TypeResponse; + parameterName?: string | undefined; + type?: TypeResponse | undefined; } /** CheckerTypeParams are parameters for checker methods that operate on a type. */ @@ -696,8 +696,8 @@ export interface GetPropertyOfTypeParams { export interface IndexInfoResponse { keyType: TypeResponse; valueType: TypeResponse; - isReadonly?: boolean; - declaration?: string; + isReadonly?: boolean | undefined; + declaration?: string | undefined; } export interface GetImportAdderEditsParams { @@ -741,7 +741,7 @@ export interface GetMemberInModuleExportsParams { */ export interface JSDocTagInfo { name: string; - text?: string; + text?: string | undefined; } /** GetReferencesToSymbolInFileParams are the parameters for the getReferencesToSymbolInFile method. */ @@ -763,7 +763,7 @@ export interface GetReferencedSymbolsForNodeParams { /** ReferencedSymbolEntry represents a symbol definition and its references. */ export interface ReferencedSymbolEntry { definition: string; - symbol?: SymbolResponse; + symbol?: SymbolResponse | undefined; references: string[]; } @@ -777,7 +777,7 @@ export interface GetSignatureUsagesParams { /** SignatureUsageResponse represents a single usage of a signature as a name-call pair. */ export interface SignatureUsageResponse { name: string; - call?: string; + call?: string | undefined; } /** GetCompletionsAtPositionParams are the parameters for the getCompletionsAtPosition method. */ @@ -786,8 +786,8 @@ export interface GetCompletionsAtPositionParams { project: string; file: DocumentIdentifier; position: number; - triggerCharacter?: string; - includeSymbol?: boolean; + triggerCharacter?: string | undefined; + includeSymbol?: boolean | undefined; } /** CompletionInfoResponse wraps a list of completion entries. */ @@ -800,48 +800,48 @@ export interface CompletionInfoResponse { export interface GetDiagnosticsParams { snapshot: number; project: string; - files?: readonly DocumentIdentifier[]; + files?: readonly DocumentIdentifier[] | undefined; } /** DiagnosticResponse is the API response for a single diagnostic. */ export interface DiagnosticResponse { /** FileName is the path of the file this diagnostic belongs to, if any. */ - fileName?: string; + fileName?: string | undefined; /** Pos is the start position of the diagnostic in the source file. */ pos: number; /** End is the end position of the diagnostic in the source file. */ end: number; /** StartPosition is the zero-based line and UTF-16 character position of Pos. */ - startPosition?: DiagnosticPositionResponse; + startPosition?: DiagnosticPositionResponse | undefined; /** EndPosition is the zero-based line and UTF-16 character position of End. */ - endPosition?: DiagnosticPositionResponse; + endPosition?: DiagnosticPositionResponse | undefined; /** SourceLines contains the source lines needed to render this diagnostic with context. */ - sourceLines?: DiagnosticSourceLineResponse[]; + sourceLines?: DiagnosticSourceLineResponse[] | undefined; /** Code is the diagnostic error code. */ code: number; /** Category is the diagnostic category (error, warning, suggestion, message). */ category: number; /** Source is a custom diagnostic-code prefix. An empty value uses the default "TS". */ - source?: string; + source?: string | undefined; /** Text is the localized diagnostic message text. */ text: string; /** ReportsUnnecessary indicates this diagnostic highlights unnecessary code. */ - reportsUnnecessary?: boolean; + reportsUnnecessary?: boolean | undefined; /** ReportsDeprecated indicates this diagnostic highlights deprecated code. */ - reportsDeprecated?: boolean; + reportsDeprecated?: boolean | undefined; /** MessageChain contains chained diagnostic messages, if any. */ - messageChain?: DiagnosticResponse[]; + messageChain?: DiagnosticResponse[] | undefined; /** RelatedInformation contains related diagnostic information, if any. */ - relatedInformation?: DiagnosticResponse[]; + relatedInformation?: DiagnosticResponse[] | undefined; } /** PrintNodeParams are the parameters for the printNode method. */ export interface PrintNodeParams { /** base64-encoded binary AST data */ data: string; - preserveSourceNewlines?: boolean; - neverAsciiEscape?: boolean; - terminateUnterminatedLiterals?: boolean; + preserveSourceNewlines?: boolean | undefined; + neverAsciiEscape?: boolean | undefined; + terminateUnterminatedLiterals?: boolean | undefined; } /** FormatNodeForInsertionParams are the parameters for the formatNodeForInsertion method. */ @@ -859,7 +859,7 @@ export interface FormatNodeForInsertionParams { export interface EmitParams { snapshot: number; project: string; - emitOnly?: number; + emitOnly?: number | undefined; } export interface EmitResponse { @@ -1063,7 +1063,7 @@ export interface BatchRequest { | "typeToTypeNode" | "updateSnapshot" | "updateTemporarySnapshot"; - params?: unknown; + params?: unknown | undefined; } export interface BatchResponse { @@ -1211,7 +1211,7 @@ export interface BatchResponse { | "updateSnapshot" | "updateTemporarySnapshot"; result: unknown; - error?: string; + error?: string | undefined; } /** @@ -1220,10 +1220,10 @@ export interface BatchResponse { * list individual documents. */ export interface APIFileChanges { - invalidateAll?: boolean; - changed?: DocumentIdentifier[]; - created?: DocumentIdentifier[]; - deleted?: DocumentIdentifier[]; + invalidateAll?: boolean | undefined; + changed?: DocumentIdentifier[] | undefined; + created?: DocumentIdentifier[] | undefined; + deleted?: DocumentIdentifier[] | undefined; } /** @@ -1235,14 +1235,14 @@ export interface RequestFileSystem { /** Files maps file names to their complete contents. */ files: Record; /** Directories maps directory names to complete listing results. */ - directories?: Record; + directories?: Record | undefined; /** Symlinks maps link paths to targets in this filesystem or the host filesystem. */ - symlinks?: Record; + symlinks?: Record | undefined; /** * RemovedPaths lists files or directory trees that must be treated as missing * even when present in an underlying snapshot or host filesystem. */ - removedPaths?: string[]; + removedPaths?: string[] | undefined; } /** @@ -1255,129 +1255,129 @@ export interface SnapshotChanges { * ChangedProjects maps project handles to the file changes within that project. * Projects not listed here (and not in RemovedProjects) are unchanged. */ - changedProjects?: Record; + changedProjects?: Record | undefined; /** * RemovedProjects lists project handles that were present in the previous * snapshot but absent from the new one. */ - removedProjects?: string[]; + removedProjects?: string[] | undefined; } export interface CreateProgramOptions { compilerOptions: CompilerOptions; - projectReferences?: ProjectReference[]; - configFileParsingDiagnostics?: DiagnosticResponse[]; + projectReferences?: ProjectReference[] | undefined; + configFileParsingDiagnostics?: DiagnosticResponse[] | undefined; } export interface CreateProgramOldProgramParams { - snapshot?: number; - project?: string; + snapshot?: number | undefined; + project?: string | undefined; } /** CompilerOptions contains the compiler options exposed by the API. */ export interface CompilerOptions { - allowJs?: boolean; - allowArbitraryExtensions?: boolean; - allowImportingTsExtensions?: boolean; - allowNonTsExtensions?: boolean; - allowUmdGlobalAccess?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - assumeChangesOnlyAffectDirectDependencies?: boolean; - checkJs?: boolean; - customConditions?: string[]; - composite?: boolean; - emitDeclarationOnly?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - declaration?: boolean; - declarationDir?: string; - declarationMap?: boolean; - deduplicatePackages?: boolean; - disableSizeLimit?: boolean; - disableSourceOfProjectReferenceRedirect?: boolean; - disableSolutionSearching?: boolean; - disableReferencedProjectLoad?: boolean; - erasableSyntaxOnly?: boolean; - exactOptionalPropertyTypes?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - isolatedModules?: boolean; - isolatedDeclarations?: boolean; - ignoreConfig?: boolean; - ignoreDeprecations?: string; - importHelpers?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - init?: boolean; - incremental?: boolean; - jsx?: JsxEmit; - jsxFactory?: string; - jsxFragmentFactory?: string; - jsxImportSource?: string; - lib?: string[]; - libReplacement?: boolean; - locale?: string; - mapRoot?: string; - module?: ModuleKind; - moduleResolution?: ModuleResolutionKind; - moduleSuffixes?: string[]; - moduleDetection?: ModuleDetectionKind; - newLine?: NewLineKind; - noEmit?: boolean; - noCheck?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitThis?: boolean; - noImplicitReturns?: boolean; - noEmitHelpers?: boolean; - noLib?: boolean; - noPropertyAccessFromIndexSignature?: boolean; - noUncheckedIndexedAccess?: boolean; - noEmitOnError?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noResolve?: boolean; - noImplicitOverride?: boolean; - noUncheckedSideEffectImports?: boolean; - outDir?: string; - paths?: Record; - preserveConstEnums?: boolean; - preserveSymlinks?: boolean; - project?: string; - resolveJsonModule?: boolean; - resolvePackageJsonExports?: boolean; - resolvePackageJsonImports?: boolean; - removeComments?: boolean; - rewriteRelativeImportExtensions?: boolean; - reactNamespace?: string; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - stableTypeOrdering?: boolean; - strict?: boolean; - strictBindCallApply?: boolean; - strictBuiltinIteratorReturn?: boolean; - strictFunctionTypes?: boolean; - strictNullChecks?: boolean; - strictPropertyInitialization?: boolean; - stripInternal?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - suppressOutputPathCheck?: boolean; - target?: ScriptTarget; - traceResolution?: boolean; - tsBuildInfoFile?: string; - typeRoots?: string[]; - types?: string[]; - useDefineForClassFields?: boolean; - useUnknownInCatchVariables?: boolean; - verbatimModuleSyntax?: boolean; - maxNodeModuleJsDepth?: number; + allowJs?: boolean | undefined; + allowArbitraryExtensions?: boolean | undefined; + allowImportingTsExtensions?: boolean | undefined; + allowNonTsExtensions?: boolean | undefined; + allowUmdGlobalAccess?: boolean | undefined; + allowUnreachableCode?: boolean | undefined; + allowUnusedLabels?: boolean | undefined; + assumeChangesOnlyAffectDirectDependencies?: boolean | undefined; + checkJs?: boolean | undefined; + customConditions?: string[] | undefined; + composite?: boolean | undefined; + emitDeclarationOnly?: boolean | undefined; + emitBOM?: boolean | undefined; + emitDecoratorMetadata?: boolean | undefined; + declaration?: boolean | undefined; + declarationDir?: string | undefined; + declarationMap?: boolean | undefined; + deduplicatePackages?: boolean | undefined; + disableSizeLimit?: boolean | undefined; + disableSourceOfProjectReferenceRedirect?: boolean | undefined; + disableSolutionSearching?: boolean | undefined; + disableReferencedProjectLoad?: boolean | undefined; + erasableSyntaxOnly?: boolean | undefined; + exactOptionalPropertyTypes?: boolean | undefined; + experimentalDecorators?: boolean | undefined; + forceConsistentCasingInFileNames?: boolean | undefined; + isolatedModules?: boolean | undefined; + isolatedDeclarations?: boolean | undefined; + ignoreConfig?: boolean | undefined; + ignoreDeprecations?: string | undefined; + importHelpers?: boolean | undefined; + inlineSourceMap?: boolean | undefined; + inlineSources?: boolean | undefined; + init?: boolean | undefined; + incremental?: boolean | undefined; + jsx?: JsxEmit | undefined; + jsxFactory?: string | undefined; + jsxFragmentFactory?: string | undefined; + jsxImportSource?: string | undefined; + lib?: string[] | undefined; + libReplacement?: boolean | undefined; + locale?: string | undefined; + mapRoot?: string | undefined; + module?: ModuleKind | undefined; + moduleResolution?: ModuleResolutionKind | undefined; + moduleSuffixes?: string[] | undefined; + moduleDetection?: ModuleDetectionKind | undefined; + newLine?: NewLineKind | undefined; + noEmit?: boolean | undefined; + noCheck?: boolean | undefined; + noErrorTruncation?: boolean | undefined; + noFallthroughCasesInSwitch?: boolean | undefined; + noImplicitAny?: boolean | undefined; + noImplicitThis?: boolean | undefined; + noImplicitReturns?: boolean | undefined; + noEmitHelpers?: boolean | undefined; + noLib?: boolean | undefined; + noPropertyAccessFromIndexSignature?: boolean | undefined; + noUncheckedIndexedAccess?: boolean | undefined; + noEmitOnError?: boolean | undefined; + noUnusedLocals?: boolean | undefined; + noUnusedParameters?: boolean | undefined; + noResolve?: boolean | undefined; + noImplicitOverride?: boolean | undefined; + noUncheckedSideEffectImports?: boolean | undefined; + outDir?: string | undefined; + paths?: Record | undefined; + preserveConstEnums?: boolean | undefined; + preserveSymlinks?: boolean | undefined; + project?: string | undefined; + resolveJsonModule?: boolean | undefined; + resolvePackageJsonExports?: boolean | undefined; + resolvePackageJsonImports?: boolean | undefined; + removeComments?: boolean | undefined; + rewriteRelativeImportExtensions?: boolean | undefined; + reactNamespace?: string | undefined; + rootDir?: string | undefined; + rootDirs?: string[] | undefined; + skipLibCheck?: boolean | undefined; + stableTypeOrdering?: boolean | undefined; + strict?: boolean | undefined; + strictBindCallApply?: boolean | undefined; + strictBuiltinIteratorReturn?: boolean | undefined; + strictFunctionTypes?: boolean | undefined; + strictNullChecks?: boolean | undefined; + strictPropertyInitialization?: boolean | undefined; + stripInternal?: boolean | undefined; + skipDefaultLibCheck?: boolean | undefined; + sourceMap?: boolean | undefined; + sourceRoot?: string | undefined; + suppressOutputPathCheck?: boolean | undefined; + target?: ScriptTarget | undefined; + traceResolution?: boolean | undefined; + tsBuildInfoFile?: string | undefined; + typeRoots?: string[] | undefined; + types?: string[] | undefined; + useDefineForClassFields?: boolean | undefined; + useUnknownInCatchVariables?: boolean | undefined; + verbatimModuleSyntax?: boolean | undefined; + maxNodeModuleJsDepth?: number | undefined; /** Internal fields */ - configFilePath?: string; + configFilePath?: string | undefined; } export interface ProjectReference { @@ -1390,34 +1390,34 @@ export interface ProjectReference { } export interface TypeAcquisition { - enable?: boolean; - include?: string[]; - exclude?: string[]; - disableFilenameBasedTypeAcquisition?: boolean; + enable?: boolean | undefined; + include?: string[] | undefined; + exclude?: string[] | undefined; + disableFilenameBasedTypeAcquisition?: boolean | undefined; } export interface TranspileOptions { - compilerOptions?: CompilerOptions; - fileName?: string; - reportDiagnostics?: boolean; + compilerOptions?: CompilerOptions | undefined; + fileName?: string | undefined; + reportDiagnostics?: boolean | undefined; } export interface ImportAdderAction { kind: "importSymbol"; - symbol?: number; - isValidTypeOnlyUseSite?: boolean; + symbol?: number | undefined; + isValidTypeOnlyUseSite?: boolean | undefined; } /** CompletionEntryResponse represents a single completion item. */ export interface CompletionEntryResponse { name: string; - kind?: number; - sortText?: string; - insertText?: string; - filterText?: string; - detail?: string; - labelDetails?: CompletionEntryLabelDetailsResponse; - symbol?: SymbolResponse; + kind?: number | undefined; + sortText?: string | undefined; + insertText?: string | undefined; + filterText?: string | undefined; + detail?: string | undefined; + labelDetails?: CompletionEntryLabelDetailsResponse | undefined; + symbol?: SymbolResponse | undefined; } export interface DiagnosticPositionResponse { @@ -1433,7 +1433,7 @@ export interface DiagnosticSourceLineResponse { export interface EmitOutputFile { fileName: string; text: string; - sourceFileName?: string; + sourceFileName?: string | undefined; } /** @@ -1456,19 +1456,19 @@ export interface RequestSymlink { * Host routes the target through the host filesystem. This is the only way a * full filesystem can access paths not supplied in the request filesystem. */ - host?: boolean; + host?: boolean | undefined; } /** ProjectFileChanges describes what source files changed within a single project. */ export interface ProjectFileChanges { /** ChangedFiles lists source file paths whose content differs. */ - changedFiles?: string[]; + changedFiles?: string[] | undefined; /** DeletedFiles lists source file paths removed from the project's program. */ - deletedFiles?: string[]; + deletedFiles?: string[] | undefined; } /** CompletionEntryLabelDetailsResponse holds additional label display text for a completion entry. */ export interface CompletionEntryLabelDetailsResponse { - detail?: string; - description?: string; + detail?: string | undefined; + description?: string | undefined; } diff --git a/packages/typescript/src/api/proto.ts b/packages/typescript/src/api/proto.ts index 6c45235499142..8e9f1f7470215 100644 --- a/packages/typescript/src/api/proto.ts +++ b/packages/typescript/src/api/proto.ts @@ -115,7 +115,7 @@ export function toUpdateSnapshotRequest(params?: UpdateSnapshotParams, snapshot? : openProjects; return { ...rest, - ...(snapshot !== undefined ? { snapshot } : {}), - ...(mergedOpenProjects !== undefined ? { openProjects: mergedOpenProjects } : {}), + snapshot, + openProjects: mergedOpenProjects, }; } diff --git a/packages/typescript/src/api/sync/api.ts b/packages/typescript/src/api/sync/api.ts index 642a41740c3f2..c85780498bfe5 100644 --- a/packages/typescript/src/api/sync/api.ts +++ b/packages/typescript/src/api/sync/api.ts @@ -235,8 +235,8 @@ export interface TranspileOptions { export interface TranspileOutput { outputText: string; - diagnostics?: readonly Diagnostic[]; - sourceMapText?: string; + diagnostics?: readonly Diagnostic[] | undefined; + sourceMapText?: string | undefined; } export { all, type AllAPIRequestGenerator, type AnyAPIRequestGenerator, type APIRequestGenerator, defer, type DeferredAPIRequestGenerator, type ExecutedGeneratorsResults } from "./generatorSupport.ts"; @@ -879,8 +879,8 @@ export class API implements FormatDiagnosticsHo const data: CreateProgramResponse = owner.client.apiRequest("createProgram", { rootFiles, createProgramOptions, - ...(oldProgram ? { oldProgram: { snapshot: oldProgram.snapshotId, project: oldProgram.getProject().id } } : {}), - ...(fileChanges ? { fileChanges } : {}), + oldProgram: oldProgram ? { snapshot: oldProgram.snapshotId, project: oldProgram.getProject().id } : undefined, + fileChanges, }); if (!data.project) { throw new Error("createProgram did not return a project"); @@ -914,8 +914,8 @@ export class API implements FormatDiagnosticsHo const data: CreateProgramResponse = yield* apiRequest("createProgram", { rootFiles, createProgramOptions, - ...(oldProgram ? { oldProgram: { snapshot: oldProgram.snapshotId, project: oldProgram.getProject().id } } : {}), - ...(fileChanges ? { fileChanges } : {}), + oldProgram: oldProgram ? { snapshot: oldProgram.snapshotId, project: oldProgram.getProject().id } : undefined, + fileChanges, }); if (!data.project) { throw new Error("createProgram did not return a project"); @@ -2088,8 +2088,8 @@ export class LanguageService { project: owner.project.id, file: document, position, - ...(options?.triggerCharacter !== undefined ? { triggerCharacter: options.triggerCharacter } : {}), - ...(options?.includeSymbol !== undefined ? { includeSymbol: options.includeSymbol } : {}), + triggerCharacter: options?.triggerCharacter, + includeSymbol: options?.includeSymbol, }); if (!data) return undefined; return { @@ -2106,8 +2106,8 @@ export class LanguageService { project: owner.project.id, file: document, position, - ...(options?.triggerCharacter !== undefined ? { triggerCharacter: options.triggerCharacter } : {}), - ...(options?.includeSymbol !== undefined ? { includeSymbol: options.includeSymbol } : {}), + triggerCharacter: options?.triggerCharacter, + includeSymbol: options?.includeSymbol, }); if (!data) return undefined; return { @@ -2523,7 +2523,7 @@ export class Program implements FormatDiagnosticsHost { const data = owner.client.apiRequest("getSyntacticDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2534,7 +2534,7 @@ export class Program implements FormatDiagnosticsHost { const data = yield* apiRequest("getSyntacticDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2560,7 +2560,7 @@ export class Program implements FormatDiagnosticsHost { const data = owner.client.apiRequest("getBindDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2571,7 +2571,7 @@ export class Program implements FormatDiagnosticsHost { const data = yield* apiRequest("getBindDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2597,7 +2597,7 @@ export class Program implements FormatDiagnosticsHost { const data = owner.client.apiRequest("getSemanticDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2608,7 +2608,7 @@ export class Program implements FormatDiagnosticsHost { const data = yield* apiRequest("getSemanticDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2634,7 +2634,7 @@ export class Program implements FormatDiagnosticsHost { const data = owner.client.apiRequest("getSuggestionDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2645,7 +2645,7 @@ export class Program implements FormatDiagnosticsHost { const data = yield* apiRequest("getSuggestionDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2671,7 +2671,7 @@ export class Program implements FormatDiagnosticsHost { const data = owner.client.apiRequest("getDeclarationDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2682,7 +2682,7 @@ export class Program implements FormatDiagnosticsHost { const data = yield* apiRequest("getDeclarationDiagnostics", { snapshot: owner.snapshotId, project: owner.project.id, - ...(files !== undefined ? { files } : {}), + files, }); return data ?? []; }, @@ -2790,7 +2790,7 @@ export class Program implements FormatDiagnosticsHost { const response = owner.client.apiRequest("emit", { snapshot: owner.snapshotId, project: owner.project.id, - ...(emitOnly !== undefined ? { emitOnly } : {}), + emitOnly, }); const fileSystem = response.emittedFilesContents.length ? { @@ -2809,7 +2809,7 @@ export class Program implements FormatDiagnosticsHost { const response = yield* apiRequest("emit", { snapshot: owner.snapshotId, project: owner.project.id, - ...(emitOnly !== undefined ? { emitOnly } : {}), + emitOnly, }); const fileSystem = response.emittedFilesContents.length ? { @@ -2842,7 +2842,7 @@ export class Program implements FormatDiagnosticsHost { const response = owner.client.apiRequest("emitToString", { snapshot: owner.snapshotId, project: owner.project.id, - ...(emitOnly !== undefined ? { emitOnly } : {}), + emitOnly, }); return toEmitOutput(response); }, @@ -2850,7 +2850,7 @@ export class Program implements FormatDiagnosticsHost { const response = yield* apiRequest("emitToString", { snapshot: owner.snapshotId, project: owner.project.id, - ...(emitOnly !== undefined ? { emitOnly } : {}), + emitOnly, }); return toEmitOutput(response); }, @@ -3465,14 +3465,10 @@ export class Checker { project: owner.project.id, name, meaning, - ...(isNode ? { location: getNodeId(location as Node) } : {}), - ...(!isNode && location - ? { - file: (location as DocumentPosition).document, - position: (location as DocumentPosition).position, - } - : {}), - ...(excludeGlobals !== undefined ? { excludeGlobals } : {}), + location: isNode ? getNodeId(location as Node) : undefined, + file: !isNode && location ? (location as DocumentPosition).document : undefined, + position: !isNode && location ? (location as DocumentPosition).position : undefined, + excludeGlobals, }); return data ? owner.objectRegistry.getOrCreateSymbol(data) : undefined; }, @@ -3484,14 +3480,10 @@ export class Checker { project: owner.project.id, name, meaning, - ...(isNode ? { location: getNodeId(location as Node) } : {}), - ...(!isNode && location - ? { - file: (location as DocumentPosition).document, - position: (location as DocumentPosition).position, - } - : {}), - ...(excludeGlobals !== undefined ? { excludeGlobals } : {}), + location: isNode ? getNodeId(location as Node) : undefined, + file: !isNode && location ? (location as DocumentPosition).document : undefined, + position: !isNode && location ? (location as DocumentPosition).position : undefined, + excludeGlobals, }); return data ? owner.objectRegistry.getOrCreateSymbol(data) : undefined; }, @@ -3516,12 +3508,9 @@ export class Checker { snapshot: owner.snapshotId, project: owner.project.id, meaning, - ...(isNode - ? { location: getNodeId(location as Node) } - : { - file: (location as DocumentPosition).document, - position: (location as DocumentPosition).position, - }), + location: isNode ? getNodeId(location as Node) : undefined, + file: isNode ? undefined : (location as DocumentPosition).document, + position: isNode ? undefined : (location as DocumentPosition).position, }); return data ? data.map(d => owner.objectRegistry.getOrCreateSymbol(d)) : []; }, @@ -3532,12 +3521,9 @@ export class Checker { snapshot: owner.snapshotId, project: owner.project.id, meaning, - ...(isNode - ? { location: getNodeId(location as Node) } - : { - file: (location as DocumentPosition).document, - position: (location as DocumentPosition).position, - }), + location: isNode ? getNodeId(location as Node) : undefined, + file: isNode ? undefined : (location as DocumentPosition).document, + position: isNode ? undefined : (location as DocumentPosition).position, }); return data ? data.map(d => owner.objectRegistry.getOrCreateSymbol(d)) : []; }, @@ -4075,8 +4061,8 @@ export class Checker { snapshot: owner.snapshotId, project: owner.project.id, type: type.id, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (!binaryData) return undefined; return decodeNode(binaryData) as TypeNode; @@ -4086,8 +4072,8 @@ export class Checker { snapshot: owner.snapshotId, project: owner.project.id, type: type.id, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (!binaryData) return undefined; return decodeNode(binaryData) as TypeNode; @@ -4109,8 +4095,8 @@ export class Checker { project: owner.project.id, signature: signature.id, kind, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (!binaryData) return undefined; return decodeNode(binaryData) as Node; @@ -4121,8 +4107,8 @@ export class Checker { project: owner.project.id, signature: signature.id, kind, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (!binaryData) return undefined; return decodeNode(binaryData) as Node; @@ -4143,8 +4129,8 @@ export class Checker { snapshot: owner.snapshotId, project: owner.project.id, type: type.id, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (typeof result !== "string") throw new TypeError("typeToString returned a non-string result"); return result; @@ -4154,8 +4140,8 @@ export class Checker { snapshot: owner.snapshotId, project: owner.project.id, type: type.id, - ...(enclosingDeclaration ? { location: getNodeId(enclosingDeclaration) } : {}), - ...(flags !== undefined ? { flags } : {}), + location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined, + flags, }); if (typeof result !== "string") throw new TypeError("typeToString returned a non-string result"); return result; @@ -5065,9 +5051,9 @@ export class Emitter { const base64 = uint8ArrayToBase64(encoded); return owner.client.apiRequest("printNode", { data: base64, - ...(options.preserveSourceNewlines !== undefined ? { preserveSourceNewlines: options.preserveSourceNewlines } : {}), - ...(options.neverAsciiEscape !== undefined ? { neverAsciiEscape: options.neverAsciiEscape } : {}), - ...(options.terminateUnterminatedLiterals !== undefined ? { terminateUnterminatedLiterals: options.terminateUnterminatedLiterals } : {}), + preserveSourceNewlines: options.preserveSourceNewlines, + neverAsciiEscape: options.neverAsciiEscape, + terminateUnterminatedLiterals: options.terminateUnterminatedLiterals, }); }, function* (node: Node, options: PrintNodeOptions = {}): Generator { @@ -5075,9 +5061,9 @@ export class Emitter { const base64 = uint8ArrayToBase64(encoded); return yield* apiRequest("printNode", { data: base64, - ...(options.preserveSourceNewlines !== undefined ? { preserveSourceNewlines: options.preserveSourceNewlines } : {}), - ...(options.neverAsciiEscape !== undefined ? { neverAsciiEscape: options.neverAsciiEscape } : {}), - ...(options.terminateUnterminatedLiterals !== undefined ? { terminateUnterminatedLiterals: options.terminateUnterminatedLiterals } : {}), + preserveSourceNewlines: options.preserveSourceNewlines, + neverAsciiEscape: options.neverAsciiEscape, + terminateUnterminatedLiterals: options.terminateUnterminatedLiterals, }); }, ); diff --git a/tools/gen-proto/main.go b/tools/gen-proto/main.go index ce65bc39772fb..ea26612e6fad1 100644 --- a/tools/gen-proto/main.go +++ b/tools/gen-proto/main.go @@ -570,6 +570,9 @@ func (r *typeRenderer) inlineStruct(structType *types.Struct) string { continue } fieldType := r.typeString(structType.Field(i).Type(), !optional && !nonnil) + if optional { + fieldType += " | undefined" + } doc := r.docs[structType.Field(i)] multiline = multiline || doc != "" fields = append(fields, fmt.Sprintf("%s%s%s: %s", inlineDoc(doc), propertyName(field), optionalMarker(optional), fieldType)) @@ -613,6 +616,9 @@ func (r *typeRenderer) declarations() (string, error) { if isParams && isArrayType(structType.Field(i).Type()) { fieldType = "readonly " + fieldType } + if optional { + fieldType += " | undefined" + } writeDoc(&out, " ", r.docs[structType.Field(i)]) fmt.Fprintf(&out, " %s%s: %s;\n", propertyName(field), optionalMarker(optional), fieldType) } diff --git a/tools/gen-proto/main_test.go b/tools/gen-proto/main_test.go index 12e4876ace63f..affa05e857a52 100644 --- a/tools/gen-proto/main_test.go +++ b/tools/gen-proto/main_test.go @@ -31,23 +31,23 @@ func TestGenerate(t *testing.T) { `export type DocumentIdentifier = string | { uri: string; };`, `export interface ReleaseParams`, `export interface UpdateSnapshotParams`, - `openProjects?: readonly DocumentIdentifier[];`, + `openProjects?: readonly DocumentIdentifier[] | undefined;`, `snapshot: number;`, `file: DocumentIdentifier;`, - `jsx?: JsxEmit;`, - `module?: ModuleKind;`, - `moduleResolution?: ModuleResolutionKind;`, - `moduleDetection?: ModuleDetectionKind;`, - `newLine?: NewLineKind;`, - `paths?: Record;`, - `target?: ScriptTarget;`, + `jsx?: JsxEmit | undefined;`, + `module?: ModuleKind | undefined;`, + `moduleResolution?: ModuleResolutionKind | undefined;`, + `moduleDetection?: ModuleDetectionKind | undefined;`, + `newLine?: NewLineKind | undefined;`, + `paths?: Record | undefined;`, + `target?: ScriptTarget | undefined;`, `/** InitializeResponse is returned by the initialize method. */ export interface InitializeResponse`, `/** UseCaseSensitiveFileNames indicates whether the host file system is case-sensitive. */ useCaseSensitiveFileNames: boolean;`, `/** CompilerOptions contains the compiler options exposed by the API. */ export interface CompilerOptions`, - `projectReferences?: ProjectReference[];`, + `projectReferences?: ProjectReference[] | undefined;`, `errors: DiagnosticResponse[];`, `getSymbolsAtPositions: APIMethod;`, `getContextualType: APIMethod;`,