Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/compiler/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import {
Program,
ProjectReference,
ReadBuildProgramHost,
ReadonlyCollection,
RepopulateDiagnosticChainInfo,
RepopulateModuleNotFoundDiagnosticChain,
returnFalse,
Expand Down Expand Up @@ -307,8 +306,8 @@ function getPendingEmitKind(
}

function hasSameKeys(
map1: ReadonlyCollection<string> | undefined,
map2: ReadonlyCollection<string> | undefined,
map1: ReadonlyMap<string, unknown> | ReadonlySet<string> | undefined,
map2: ReadonlyMap<string, unknown> | ReadonlySet<string> | undefined,
): boolean {
// Has same size and every key is present in both maps
return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !forEachKey(map1, key => !map2.has(key));
Expand Down
11 changes: 0 additions & 11 deletions src/compiler/corePublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@ export interface SortedArray<T> extends Array<T> {
" __sortedArrayBrand": any;
}

/**
* Common read methods for ES6 Map/Set.
*
* @internal
*/
export interface ReadonlyCollection<K> {
readonly size: number;
has(key: K): boolean;
keys(): IterableIterator<K>;
}

/** @internal */
export type EqualityComparer<T> = (a: T, b: T) => boolean;

Expand Down
3 changes: 1 addition & 2 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ import {
PunctuationSyntaxKind,
QualifiedName,
QuestionQuestionEqualsToken,
ReadonlyCollection,
ReadonlyTextRange,
removeTrailingDirectorySeparator,
RequireOrImportCall,
Expand Down Expand Up @@ -734,7 +733,7 @@ export function forEachEntry<K, V, U>(map: ReadonlyMap<K, V>, callback: (value:
*
* @internal
*/
export function forEachKey<K, T>(map: ReadonlyCollection<K>, callback: (key: K) => T | undefined): T | undefined {
export function forEachKey<K, T>(map: ReadonlyMap<K, unknown> | ReadonlySet<K>, callback: (key: K) => T | undefined): T | undefined {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was funky; swap the argument types and inference breaks. Need to retest to see if my inference fixups fixed this, though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, still screwy. I think I'll file a bug.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const iterator = map.keys();
for (const key of iterator) {
const result = callback(key);
Expand Down
5 changes: 2 additions & 3 deletions src/server/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ import {
ProjectPackageJsonInfo,
ProjectReference,
ReadMapFile,
ReadonlyCollection,
removeFileExtension,
removeIgnoredPath,
removeMinAndVersionNumbers,
Expand Down Expand Up @@ -4345,7 +4344,7 @@ export class ProjectService {
}

/** @internal */
loadAncestorProjectTree(forProjects?: ReadonlyCollection<string>) {
loadAncestorProjectTree(forProjects?: ReadonlyMap<string, boolean> | ReadonlySet<string>) {
forProjects ??= new Set(
mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.isInitialLoadPending() ? key : undefined),
);
Expand All @@ -4364,7 +4363,7 @@ export class ProjectService {
}
}

private ensureProjectChildren(project: ConfiguredProject, forProjects: ReadonlyCollection<string>, seenProjects: Set<NormalizedPath>) {
private ensureProjectChildren(project: ConfiguredProject, forProjects: ReadonlyMap<string, boolean> | ReadonlySet<string>, seenProjects: Set<NormalizedPath>) {
if (!tryAddToSet(seenProjects, project.canonicalConfigFilePath)) return;

// If this project disables child load ignore it
Expand Down
3 changes: 1 addition & 2 deletions src/services/codefixes/convertToEsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import {
PropertyAccessExpression,
QuotePreference,
rangeContainsRange,
ReadonlyCollection,
ScriptTarget,
some,
SourceFile,
Expand Down Expand Up @@ -396,7 +395,7 @@ function convertReExportAll(reExported: StringLiteralLike, checker: TypeChecker)
// `module.exports = require("x");` ==> `export * from "x"; export { default } from "x";`
const moduleSpecifier = reExported.text;
const moduleSymbol = checker.getSymbolAtLocation(reExported);
const exports = moduleSymbol ? moduleSymbol.exports! : emptyMap as ReadonlyCollection<__String>;
const exports = moduleSymbol ? moduleSymbol.exports! : emptyMap as ReadonlyMap<__String, never>;
return exports.has(InternalSymbolName.ExportEquals) ? [[reExportDefault(moduleSpecifier)], true] :
!exports.has(InternalSymbolName.Default) ? [[reExportStar(moduleSpecifier)], false] :
// If there's some non-default export, must include both `export *` and `export default`.
Expand Down
2 changes: 1 addition & 1 deletion src/testRunner/unittests/helpers/baseline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function baselineProgram(baseline: string[], [program, builderProgram]: CommandL
baseline.push("");
}

export function generateSourceMapBaselineFiles(sys: ts.System & { writtenFiles: ts.ReadonlyCollection<ts.Path>; }) {
export function generateSourceMapBaselineFiles(sys: ts.System & { writtenFiles: Map<ts.Path, unknown> | Set<ts.Path>; }) {
const mapFileNames = ts.mapDefinedIterator(sys.writtenFiles.keys(), f => f.endsWith(".map") ? f : undefined);
for (const mapFile of mapFileNames) {
const text = Harness.SourceMapRecorder.getSourceMapRecordWithSystem(sys, mapFile);
Expand Down