Skip to content

Commit d375574

Browse files
committed
Some changes to improve api-extractor output
1 parent d6f739a commit d375574

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

src/compiler/program.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ export interface SourceFileImportsList {
570570
* Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
571571
* provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
572572
*/
573-
export function getModeForFileReference(ref: FileReference | string, containingFileMode: SourceFile["impliedNodeFormat"]) {
573+
export function getModeForFileReference(ref: FileReference | string, containingFileMode: SourceFile["impliedNodeFormat"]): ModuleKind.CommonJS | ModuleKind.ESNext | undefined {
574574
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
575575
}
576576

@@ -612,7 +612,7 @@ export function isExclusivelyTypeOnlyImportOrExport(decl: ImportDeclaration | Ex
612612
* @param usage The module reference string
613613
* @returns The final resolution mode of the import
614614
*/
615-
export function getModeForUsageLocation(file: {impliedNodeFormat?: SourceFile["impliedNodeFormat"]}, usage: StringLiteralLike) {
615+
export function getModeForUsageLocation(file: {impliedNodeFormat?: SourceFile["impliedNodeFormat"]}, usage: StringLiteralLike): ModuleKind.CommonJS | ModuleKind.ESNext | undefined {
616616
if (file.impliedNodeFormat === undefined) return undefined;
617617
if ((isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent))) {
618618
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);

src/compiler/tsbuildPublic.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export function createBuilderStatusReporter(system: System, pretty?: boolean): D
194194
};
195195
}
196196

197-
function createSolutionBuilderHostBase<T extends BuilderProgram>(system: System, createProgram: CreateProgram<T> | undefined, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter) {
197+
function createSolutionBuilderHostBase<T extends BuilderProgram>(system: System, createProgram: CreateProgram<T> | undefined, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter): SolutionBuilderHostBase<T> {
198198
const host = createProgramHost(system, createProgram) as SolutionBuilderHostBase<T>;
199199
host.getModifiedTime = system.getModifiedTime ? path => system.getModifiedTime!(path) : returnUndefined;
200200
host.setModifiedTime = system.setModifiedTime ? (path, date) => system.setModifiedTime!(path, date) : noop;
@@ -205,13 +205,13 @@ function createSolutionBuilderHostBase<T extends BuilderProgram>(system: System,
205205
return host;
206206
}
207207

208-
export function createSolutionBuilderHost<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(system = sys, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary) {
208+
export function createSolutionBuilderHost<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(system: System = sys, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportErrorSummary?: ReportEmitErrorSummary): SolutionBuilderHost<T> {
209209
const host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus) as SolutionBuilderHost<T>;
210210
host.reportErrorSummary = reportErrorSummary;
211211
return host;
212212
}
213213

214-
export function createSolutionBuilderWithWatchHost<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(system = sys, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter) {
214+
export function createSolutionBuilderWithWatchHost<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(system: System = sys, createProgram?: CreateProgram<T>, reportDiagnostic?: DiagnosticReporter, reportSolutionBuilderStatus?: DiagnosticReporter, reportWatchStatus?: WatchStatusReporter): SolutionBuilderWithWatchHost<T> {
215215
const host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus) as SolutionBuilderWithWatchHost<T>;
216216
const watchHost = createWatchHost(system, reportWatchStatus);
217217
copyProperties(host, watchHost);

src/compiler/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9307,7 +9307,7 @@ type PragmaArgTypeOptional<TDesc, TName extends string> =
93079307
: {[K in TName]: PragmaArgTypeMaybeCapture<TDesc>};
93089308

93099309
/** @internal */
9310-
type UnionToIntersection<U> =
9310+
export type UnionToIntersection<U> =
93119311
(U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
93129312

93139313
/** @internal */

src/compiler/watchPublic.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface ReadBuildProgramHost {
2828
/** @internal */
2929
getBuildInfo?(fileName: string, configFilePath: string | undefined): BuildInfo | undefined;
3030
}
31-
export function readBuilderProgram(compilerOptions: CompilerOptions, host: ReadBuildProgramHost) {
31+
export function readBuilderProgram(compilerOptions: CompilerOptions, host: ReadBuildProgramHost): EmitAndSemanticDiagnosticsBuilderProgram | undefined {
3232
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(compilerOptions);
3333
if (!buildInfoPath) return undefined;
3434
let buildInfo;
@@ -45,7 +45,7 @@ export function readBuilderProgram(compilerOptions: CompilerOptions, host: ReadB
4545
return createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
4646
}
4747

48-
export function createIncrementalCompilerHost(options: CompilerOptions, system = sys): CompilerHost {
48+
export function createIncrementalCompilerHost(options: CompilerOptions, system: System = sys): CompilerHost {
4949
const host = createCompilerHostWorker(options, /*setParentNodes*/ undefined, system);
5050
host.createHash = maybeBind(system, system.createHash);
5151
host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;

src/deprecatedCompat/deprecations.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Debug, DeprecationOptions, hasProperty } from "./_namespaces/ts";
1+
import { Debug, DeprecationOptions, hasProperty, UnionToIntersection } from "./_namespaces/ts";
22

33
// The following are deprecations for the public API. Deprecated exports are removed from the compiler itself
44
// and compatible implementations are added here, along with an appropriate deprecation warning using
@@ -29,7 +29,6 @@ type OverloadParameters<T extends OverloadDefinitions> = Parameters<{ [P in Over
2929
// type OverloadFunction<T extends OverloadDefinitions, R extends ((...args: any[]) => any)[] = [], O = unknown> =
3030
// R["length"] extends keyof T ? OverloadFunction<T, [...R, T[R["length"]]], O & T[R["length"]]> :
3131
// unknown extends O ? never : O;
32-
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
3332
type OverloadFunction<T extends OverloadDefinitions> = UnionToIntersection<T[keyof T]>;
3433

3534
/** Maps each ordinal in a set of overload definitions to a function that can be used to bind its arguments. */

src/services/codefixes/helpers.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ export function createSignatureDeclarationFromCallExpression(
417417
}
418418
}
419419

420-
interface ArgumentTypeParameterAndConstraint {
420+
/** @internal */
421+
export interface ArgumentTypeParameterAndConstraint {
421422
argumentType: Type;
422423
constraint?: TypeNode;
423424
}

src/services/sourcemaps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function getDocumentPositionMapper(
155155
host: DocumentPositionMapperHost,
156156
generatedFileName: string,
157157
generatedFileLineInfo: LineInfo,
158-
readMapFile: ReadMapFile) {
158+
readMapFile: ReadMapFile): DocumentPositionMapper | undefined {
159159
let mapFileName = tryGetSourceMappingURL(generatedFileLineInfo);
160160
if (mapFileName) {
161161
const match = base64UrlRegExp.exec(mapFileName);

0 commit comments

Comments
 (0)