Skip to content

Commit bfeb927

Browse files
authored
Remove Push from public API (#52122)
1 parent 91822db commit bfeb927

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

src/compiler/commandLineParser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,7 @@ function convertConfigFileToObject(sourceFile: JsonSourceFile, errors: Push<Diag
22882288
/**
22892289
* Convert the json syntax tree into the json value
22902290
*/
2291-
export function convertToObject(sourceFile: JsonSourceFile, errors: Push<Diagnostic>): any {
2291+
export function convertToObject(sourceFile: JsonSourceFile, errors: Diagnostic[]): any {
22922292
return convertToObjectWorker(sourceFile, sourceFile.statements[0]?.expression, errors, /*returnValue*/ true, /*knownRootOptions*/ undefined, /*jsonConversionNotifier*/ undefined);
22932293
}
22942294

@@ -3177,7 +3177,7 @@ function parseConfig(
31773177
basePath: string,
31783178
configFileName: string | undefined,
31793179
resolutionStack: string[],
3180-
errors: Push<Diagnostic>,
3180+
errors: Diagnostic[],
31813181
extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>
31823182
): ParsedTsconfig {
31833183
basePath = normalizeSlashes(basePath);
@@ -3432,7 +3432,7 @@ function getExtendedConfig(
34323432
extendedConfigPath: string,
34333433
host: ParseConfigHost,
34343434
resolutionStack: string[],
3435-
errors: Push<Diagnostic>,
3435+
errors: Diagnostic[],
34363436
extendedConfigCache: Map<string, ExtendedConfigCacheEntry> | undefined,
34373437
result: ExtendsResult
34383438
): ParsedTsconfig | undefined {

src/compiler/corePublic.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ export interface Collection<K> extends ReadonlyCollection<K> {
4444
clear(): void;
4545
}
4646

47-
/** Array that is only intended to be pushed to, never read. */
47+
/**
48+
* Array that is only intended to be pushed to, never read.
49+
*
50+
* @internal
51+
*/
4852
export interface Push<T> {
4953
push(...values: T[]): void;
50-
/** @internal */ readonly length: number;
54+
readonly length: number;
5155
}
5256

5357
/** @internal */

src/compiler/utilitiesPublic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ export const supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "
602602
export function validateLocaleAndSetLanguage(
603603
locale: string,
604604
sys: { getExecutingFilePath(): string, resolvePath(path: string): string, fileExists(fileName: string): boolean, readFile(fileName: string): string | undefined },
605-
errors?: Push<Diagnostic>) {
605+
errors?: Diagnostic[]) {
606606
const lowerCaseLocale = locale.toLowerCase();
607607
const matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(lowerCaseLocale);
608608

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3966,10 +3966,6 @@ declare namespace ts {
39663966
interface SortedArray<T> extends Array<T> {
39673967
" __sortedArrayBrand": any;
39683968
}
3969-
/** Array that is only intended to be pushed to, never read. */
3970-
interface Push<T> {
3971-
push(...values: T[]): void;
3972-
}
39733969
type Path = string & {
39743970
__pathBrand: any;
39753971
};
@@ -8558,7 +8554,7 @@ declare namespace ts {
85588554
resolvePath(path: string): string;
85598555
fileExists(fileName: string): boolean;
85608556
readFile(fileName: string): string | undefined;
8561-
}, errors?: Push<Diagnostic>): void;
8557+
}, errors?: Diagnostic[]): void;
85628558
function getOriginalNode(node: Node): Node;
85638559
function getOriginalNode<T extends Node>(node: Node, nodeTest: (node: Node) => node is T): T;
85648560
function getOriginalNode(node: Node | undefined): Node | undefined;
@@ -9138,7 +9134,7 @@ declare namespace ts {
91389134
/**
91399135
* Convert the json syntax tree into the json value
91409136
*/
9141-
function convertToObject(sourceFile: JsonSourceFile, errors: Push<Diagnostic>): any;
9137+
function convertToObject(sourceFile: JsonSourceFile, errors: Diagnostic[]): any;
91429138
/**
91439139
* Parse the contents of a config file (tsconfig.json).
91449140
* @param json The contents of the config file to parse

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ declare namespace ts {
3131
interface SortedArray<T> extends Array<T> {
3232
" __sortedArrayBrand": any;
3333
}
34-
/** Array that is only intended to be pushed to, never read. */
35-
interface Push<T> {
36-
push(...values: T[]): void;
37-
}
3834
type Path = string & {
3935
__pathBrand: any;
4036
};
@@ -4623,7 +4619,7 @@ declare namespace ts {
46234619
resolvePath(path: string): string;
46244620
fileExists(fileName: string): boolean;
46254621
readFile(fileName: string): string | undefined;
4626-
}, errors?: Push<Diagnostic>): void;
4622+
}, errors?: Diagnostic[]): void;
46274623
function getOriginalNode(node: Node): Node;
46284624
function getOriginalNode<T extends Node>(node: Node, nodeTest: (node: Node) => node is T): T;
46294625
function getOriginalNode(node: Node | undefined): Node | undefined;
@@ -5203,7 +5199,7 @@ declare namespace ts {
52035199
/**
52045200
* Convert the json syntax tree into the json value
52055201
*/
5206-
function convertToObject(sourceFile: JsonSourceFile, errors: Push<Diagnostic>): any;
5202+
function convertToObject(sourceFile: JsonSourceFile, errors: Diagnostic[]): any;
52075203
/**
52085204
* Parse the contents of a config file (tsconfig.json).
52095205
* @param json The contents of the config file to parse

0 commit comments

Comments
 (0)