Revert the type change to ts.Map (#39366)

This commit is contained in:
Ron Buckton 2020-07-01 17:00:26 -07:00 committed by GitHub
parent 852800bb98
commit 7b942b4fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 443 additions and 405 deletions

View File

@ -15,7 +15,7 @@ namespace ts {
referenced: boolean;
}
export function getModuleInstanceState(node: ModuleDeclaration, visited?: Map<number, ModuleInstanceState | undefined>): ModuleInstanceState {
export function getModuleInstanceState(node: ModuleDeclaration, visited?: ESMap<number, ModuleInstanceState | undefined>): ModuleInstanceState {
if (node.body && !node.body.parent) {
// getModuleInstanceStateForAliasTarget needs to walk up the parent chain, so parent pointers must be set on this tree already
setParent(node.body, node);
@ -35,7 +35,7 @@ namespace ts {
return result;
}
function getModuleInstanceStateWorker(node: Node, visited: Map<number, ModuleInstanceState | undefined>): ModuleInstanceState {
function getModuleInstanceStateWorker(node: Node, visited: ESMap<number, ModuleInstanceState | undefined>): ModuleInstanceState {
// A module is uninstantiated if it contains only
switch (node.kind) {
// 1. interface declarations, type alias declarations
@ -107,7 +107,7 @@ namespace ts {
return ModuleInstanceState.Instantiated;
}
function getModuleInstanceStateForAliasTarget(specifier: ExportSpecifier, visited: Map<number, ModuleInstanceState | undefined>) {
function getModuleInstanceStateForAliasTarget(specifier: ExportSpecifier, visited: ESMap<number, ModuleInstanceState | undefined>) {
const name = specifier.propertyName || specifier.name;
let p: Node | undefined = specifier.parent;
while (p) {

View File

@ -24,7 +24,7 @@ namespace ts {
/**
* Cache of bind and check diagnostics for files with their Path being the key
*/
semanticDiagnosticsPerFile?: ReadonlyMap<Path, readonly ReusableDiagnostic[] | readonly Diagnostic[]> | undefined;
semanticDiagnosticsPerFile?: ReadonlyESMap<Path, readonly ReusableDiagnostic[] | readonly Diagnostic[]> | undefined;
/**
* The map has key by source file's path that has been changed
*/
@ -41,7 +41,7 @@ namespace ts {
* Map of file signatures, with key being file path, calculated while getting current changed file's affected files
* These will be committed whenever the iteration through affected files of current changed file is complete
*/
currentAffectedFilesSignatures?: ReadonlyMap<Path, string> | undefined;
currentAffectedFilesSignatures?: ReadonlyESMap<Path, string> | undefined;
/**
* Newly computed visible to outside referencedSet
*/
@ -65,7 +65,7 @@ namespace ts {
/**
* Files pending to be emitted kind.
*/
affectedFilesPendingEmitKind?: ReadonlyMap<Path, BuilderFileEmit> | undefined;
affectedFilesPendingEmitKind?: ReadonlyESMap<Path, BuilderFileEmit> | undefined;
/**
* Current index to retrieve pending affected file
*/
@ -89,7 +89,7 @@ namespace ts {
/**
* Cache of bind and check diagnostics for files with their Path being the key
*/
semanticDiagnosticsPerFile: Map<Path, readonly Diagnostic[]> | undefined;
semanticDiagnosticsPerFile: ESMap<Path, readonly Diagnostic[]> | undefined;
/**
* The map has key by source file's path that has been changed
*/
@ -110,7 +110,7 @@ namespace ts {
* Map of file signatures, with key being file path, calculated while getting current changed file's affected files
* These will be committed whenever the iteration through affected files of current changed file is complete
*/
currentAffectedFilesSignatures: Map<Path, string> | undefined;
currentAffectedFilesSignatures: ESMap<Path, string> | undefined;
/**
* Newly computed visible to outside referencedSet
*/
@ -142,7 +142,7 @@ namespace ts {
/**
* Files pending to be emitted kind.
*/
affectedFilesPendingEmitKind: Map<Path, BuilderFileEmit> | undefined;
affectedFilesPendingEmitKind: ESMap<Path, BuilderFileEmit> | undefined;
/**
* Current index to retrieve pending affected file
*/
@ -154,7 +154,7 @@ namespace ts {
/**
* Already seen emitted files
*/
seenEmittedFiles: Map<Path, BuilderFileEmit> | undefined;
seenEmittedFiles: ESMap<Path, BuilderFileEmit> | undefined;
/**
* true if program has been emitted
*/
@ -1140,7 +1140,7 @@ namespace ts {
}
}
function getMapOfReferencedSet(mapLike: MapLike<readonly string[]> | undefined, toPath: (path: string) => Path): ReadonlyMap<Path, BuilderState.ReferencedSet> | undefined {
function getMapOfReferencedSet(mapLike: MapLike<readonly string[]> | undefined, toPath: (path: string) => Path): ReadonlyESMap<Path, BuilderState.ReferencedSet> | undefined {
if (!mapLike) return undefined;
const map = new Map<Path, BuilderState.ReferencedSet>();
// Copies keys/values from template. Note that for..in will not throw if

View File

@ -15,36 +15,36 @@ namespace ts {
/**
* Information of the file eg. its version, signature etc
*/
fileInfos: ReadonlyMap<Path, BuilderState.FileInfo>;
fileInfos: ReadonlyESMap<Path, BuilderState.FileInfo>;
/**
* Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled
* Otherwise undefined
* Thus non undefined value indicates, module emit
*/
readonly referencedMap?: ReadonlyMap<Path, BuilderState.ReferencedSet> | undefined;
readonly referencedMap?: ReadonlyESMap<Path, BuilderState.ReferencedSet> | undefined;
/**
* Contains the map of exported modules ReferencedSet=exported module files from the file if module emit is enabled
* Otherwise undefined
*/
readonly exportedModulesMap?: ReadonlyMap<Path, BuilderState.ReferencedSet> | undefined;
readonly exportedModulesMap?: ReadonlyESMap<Path, BuilderState.ReferencedSet> | undefined;
}
export interface BuilderState {
/**
* Information of the file eg. its version, signature etc
*/
fileInfos: Map<Path, BuilderState.FileInfo>;
fileInfos: ESMap<Path, BuilderState.FileInfo>;
/**
* Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled
* Otherwise undefined
* Thus non undefined value indicates, module emit
*/
readonly referencedMap: ReadonlyMap<Path, BuilderState.ReferencedSet> | undefined;
readonly referencedMap: ReadonlyESMap<Path, BuilderState.ReferencedSet> | undefined;
/**
* Contains the map of exported modules ReferencedSet=exported module files from the file if module emit is enabled
* Otherwise undefined
*/
readonly exportedModulesMap: Map<Path, BuilderState.ReferencedSet> | undefined;
readonly exportedModulesMap: ESMap<Path, BuilderState.ReferencedSet> | undefined;
/**
* Map of files that have already called update signature.
* That means hence forth these files are assumed to have
@ -83,7 +83,7 @@ namespace ts {
* Exported modules to from declaration emit being computed.
* This can contain false in the affected file path to specify that there are no exported module(types from other modules) for this file
*/
export type ComputingExportedModulesMap = Map<Path, ReferencedSet | false>;
export type ComputingExportedModulesMap = ESMap<Path, ReferencedSet | false>;
/**
* Get the referencedFile from the imported module symbol
@ -192,7 +192,7 @@ namespace ts {
/**
* Returns true if oldState is reusable, that is the emitKind = module/non module has not changed
*/
export function canReuseOldState(newReferencedMap: ReadonlyMap<Path, ReferencedSet> | undefined, oldState: Readonly<ReusableBuilderState> | undefined) {
export function canReuseOldState(newReferencedMap: ReadonlyESMap<Path, ReferencedSet> | undefined, oldState: Readonly<ReusableBuilderState> | undefined) {
return oldState && !oldState.referencedMap === !newReferencedMap;
}
@ -258,7 +258,7 @@ namespace ts {
/**
* Gets the files affected by the path from the program
*/
export function getFilesAffectedBy(state: BuilderState, programOfThisState: Program, path: Path, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash, cacheToUpdateSignature?: Map<Path, string>, exportedModulesMapCache?: ComputingExportedModulesMap): readonly SourceFile[] {
export function getFilesAffectedBy(state: BuilderState, programOfThisState: Program, path: Path, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash, cacheToUpdateSignature?: ESMap<Path, string>, exportedModulesMapCache?: ComputingExportedModulesMap): readonly SourceFile[] {
// Since the operation could be cancelled, the signatures are always stored in the cache
// They will be committed once it is safe to use them
// eg when calling this api from tsserver, if there is no cancellation of the operation
@ -285,7 +285,7 @@ namespace ts {
* Updates the signatures from the cache into state's fileinfo signatures
* This should be called whenever it is safe to commit the state of the builder
*/
export function updateSignaturesFromCache(state: BuilderState, signatureCache: Map<Path, string>) {
export function updateSignaturesFromCache(state: BuilderState, signatureCache: ESMap<Path, string>) {
signatureCache.forEach((signature, path) => updateSignatureOfFile(state, signature, path));
}
@ -297,7 +297,7 @@ namespace ts {
/**
* Returns if the shape of the signature has changed since last emit
*/
export function updateShapeSignature(state: Readonly<BuilderState>, programOfThisState: Program, sourceFile: SourceFile, cacheToUpdateSignature: Map<Path, string>, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash, exportedModulesMapCache?: ComputingExportedModulesMap) {
export function updateShapeSignature(state: Readonly<BuilderState>, programOfThisState: Program, sourceFile: SourceFile, cacheToUpdateSignature: ESMap<Path, string>, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash, exportedModulesMapCache?: ComputingExportedModulesMap) {
Debug.assert(!!sourceFile);
Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state");
@ -518,7 +518,7 @@ namespace ts {
/**
* When program emits modular code, gets the files affected by the sourceFile whose shape has changed
*/
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state: BuilderState, programOfThisState: Program, sourceFileWithUpdatedShape: SourceFile, cacheToUpdateSignature: Map<Path, string>, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash | undefined, exportedModulesMapCache: ComputingExportedModulesMap | undefined) {
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state: BuilderState, programOfThisState: Program, sourceFileWithUpdatedShape: SourceFile, cacheToUpdateSignature: ESMap<Path, string>, cancellationToken: CancellationToken | undefined, computeHash: ComputeHash | undefined, exportedModulesMapCache: ComputingExportedModulesMap | undefined) {
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
}

View File

@ -134,7 +134,7 @@ namespace ts {
EmptyObjectFacts = All,
}
const typeofEQFacts: ReadonlyMap<string, TypeFacts> = createMapFromTemplate({
const typeofEQFacts: ReadonlyESMap<string, TypeFacts> = createMapFromTemplate({
string: TypeFacts.TypeofEQString,
number: TypeFacts.TypeofEQNumber,
bigint: TypeFacts.TypeofEQBigInt,
@ -145,7 +145,7 @@ namespace ts {
function: TypeFacts.TypeofEQFunction
});
const typeofNEFacts: ReadonlyMap<string, TypeFacts> = createMapFromTemplate({
const typeofNEFacts: ReadonlyESMap<string, TypeFacts> = createMapFromTemplate({
string: TypeFacts.TypeofNEString,
number: TypeFacts.TypeofNENumber,
bigint: TypeFacts.TypeofNEBigInt,
@ -826,10 +826,10 @@ namespace ts {
readonly firstFile: SourceFile;
readonly secondFile: SourceFile;
/** Key is symbol name. */
readonly conflictingSymbols: Map<string, DuplicateInfoForSymbol>;
readonly conflictingSymbols: ESMap<string, DuplicateInfoForSymbol>;
}
/** Key is "/path/to/a.ts|/path/to/b.ts". */
let amalgamatedDuplicates: Map<string, DuplicateInfoForFiles> | undefined;
let amalgamatedDuplicates: ESMap<string, DuplicateInfoForFiles> | undefined;
const reverseMappedCache = createMap<Type | undefined>();
let inInferTypeForHomomorphicMappedType = false;
let ambientModulesCache: Symbol[] | undefined;
@ -839,7 +839,7 @@ namespace ts {
* This is only used if there is no exact match.
*/
let patternAmbientModules: PatternAmbientModule[];
let patternAmbientModuleAugmentations: Map<string, Symbol> | undefined;
let patternAmbientModuleAugmentations: ESMap<string, Symbol> | undefined;
let globalObjectType: ObjectType;
let globalFunctionType: ObjectType;
@ -907,7 +907,7 @@ namespace ts {
const mergedSymbols: Symbol[] = [];
const symbolLinks: SymbolLinks[] = [];
const nodeLinks: NodeLinks[] = [];
const flowLoopCaches: Map<string, Type>[] = [];
const flowLoopCaches: ESMap<string, Type>[] = [];
const flowLoopNodes: FlowNode[] = [];
const flowLoopKeys: string[] = [];
const flowLoopTypes: Type[][] = [];
@ -923,7 +923,7 @@ namespace ts {
const diagnostics = createDiagnosticCollection();
const suggestionDiagnostics = createDiagnosticCollection();
const typeofTypesByName: ReadonlyMap<string, Type> = createMapFromTemplate<Type>({
const typeofTypesByName: ReadonlyESMap<string, Type> = createMapFromTemplate<Type>({
string: stringType,
number: numberType,
bigint: bigintType,
@ -3753,7 +3753,7 @@ namespace ts {
return rightMeaning === SymbolFlags.Value ? SymbolFlags.Value : SymbolFlags.Namespace;
}
function getAccessibleSymbolChain(symbol: Symbol | undefined, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, useOnlyExternalAliasing: boolean, visitedSymbolTablesMap: Map<string, SymbolTable[]> = createMap()): Symbol[] | undefined {
function getAccessibleSymbolChain(symbol: Symbol | undefined, enclosingDeclaration: Node | undefined, meaning: SymbolFlags, useOnlyExternalAliasing: boolean, visitedSymbolTablesMap: ESMap<string, SymbolTable[]> = createMap()): Symbol[] | undefined {
if (!(symbol && !isPropertyOrMethodDeclarationSymbol(symbol))) {
return undefined;
}
@ -5878,7 +5878,7 @@ namespace ts {
const enclosingDeclaration = context.enclosingDeclaration!;
let results: Statement[] = [];
const visitedSymbols = new Set<number>();
let deferredPrivates: Map<string, Symbol> | undefined;
let deferredPrivates: ESMap<string, Symbol> | undefined;
const oldcontext = context;
context = {
...oldcontext,
@ -7186,15 +7186,15 @@ namespace ts {
// State
encounteredError: boolean;
visitedTypes: Set<number> | undefined;
symbolDepth: Map<string, number> | undefined;
symbolDepth: ESMap<string, number> | undefined;
inferTypeParameters: TypeParameter[] | undefined;
approximateLength: number;
truncating?: boolean;
typeParameterSymbolList?: Set<number>;
typeParameterNames?: Map<string, Identifier>;
typeParameterNames?: ESMap<string, Identifier>;
typeParameterNamesByText?: Set<string>;
usedSymbolNames?: Set<string>;
remappedSymbolNames?: Map<string, string>;
remappedSymbolNames?: ESMap<string, string>;
}
function isDefaultBindingContext(location: Node) {
@ -10829,7 +10829,7 @@ namespace ts {
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: __String): Symbol | undefined {
let singleProp: Symbol | undefined;
let propSet: Map<string, Symbol> | undefined;
let propSet: ESMap<string, Symbol> | undefined;
let indexTypes: Type[] | undefined;
const isUnion = containingType.flags & TypeFlags.Union;
// Flags we want to propagate to the result if they exist in all source symbols
@ -12890,7 +12890,7 @@ namespace ts {
return links.resolvedType;
}
function addTypeToIntersection(typeSet: Map<string, Type>, includes: TypeFlags, type: Type) {
function addTypeToIntersection(typeSet: ESMap<string, Type>, includes: TypeFlags, type: Type) {
const flags = type.flags;
if (flags & TypeFlags.Intersection) {
return addTypesToIntersection(typeSet, includes, (<IntersectionType>type).types);
@ -12920,7 +12920,7 @@ namespace ts {
// Add the given types to the given type set. Order is preserved, freshness is removed from literal
// types, duplicates are removed, and nested types of the given kind are flattened into the set.
function addTypesToIntersection(typeSet: Map<string, Type>, includes: TypeFlags, types: readonly Type[]) {
function addTypesToIntersection(typeSet: ESMap<string, Type>, includes: TypeFlags, types: readonly Type[]) {
for (const type of types) {
includes = addTypeToIntersection(typeSet, includes, getRegularTypeOfLiteralType(type));
}
@ -13037,7 +13037,7 @@ namespace ts {
// Also, unlike union types, the order of the constituent types is preserved in order that overload resolution
// for intersections of types with signatures can be deterministic.
function getIntersectionType(types: readonly Type[], aliasSymbol?: Symbol, aliasTypeArguments?: readonly Type[]): Type {
const typeMembershipMap: Map<string, Type> = createMap();
const typeMembershipMap: ESMap<string, Type> = createMap();
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
const typeSet: Type[] = arrayFrom(typeMembershipMap.values());
// An intersection type is considered empty if it contains
@ -15077,7 +15077,7 @@ namespace ts {
function checkTypeRelatedToAndOptionallyElaborate(
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
errorNode: Node | undefined,
expr: Expression | undefined,
headMessage: DiagnosticMessage | undefined,
@ -15099,7 +15099,7 @@ namespace ts {
node: Expression | undefined,
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
headMessage: DiagnosticMessage | undefined,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
@ -15136,7 +15136,7 @@ namespace ts {
node: Expression,
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
headMessage: DiagnosticMessage | undefined,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
@ -15165,7 +15165,7 @@ namespace ts {
node: ArrowFunction,
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
): boolean {
@ -15252,7 +15252,7 @@ namespace ts {
iterator: ElaborationIterator,
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
) {
@ -15366,7 +15366,7 @@ namespace ts {
node: JsxAttributes,
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
) {
@ -15467,7 +15467,7 @@ namespace ts {
node: ArrayLiteralExpression,
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
) {
@ -15520,7 +15520,7 @@ namespace ts {
node: ObjectLiteralExpression,
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
errorOutputContainer: { errors?: Diagnostic[], skipLogging?: boolean } | undefined
) {
@ -15811,7 +15811,7 @@ namespace ts {
return true;
}
function isSimpleTypeRelatedTo(source: Type, target: Type, relation: Map<string, RelationComparisonResult>, errorReporter?: ErrorReporter) {
function isSimpleTypeRelatedTo(source: Type, target: Type, relation: ESMap<string, RelationComparisonResult>, errorReporter?: ErrorReporter) {
const s = source.flags;
const t = target.flags;
if (t & TypeFlags.AnyOrUnknown || s & TypeFlags.Never || source === wildcardType) return true;
@ -15848,7 +15848,7 @@ namespace ts {
return false;
}
function isTypeRelatedTo(source: Type, target: Type, relation: Map<string, RelationComparisonResult>) {
function isTypeRelatedTo(source: Type, target: Type, relation: ESMap<string, RelationComparisonResult>) {
if (isFreshLiteralType(source)) {
source = (<FreshableType>source).regularType;
}
@ -15911,7 +15911,7 @@ namespace ts {
function checkTypeRelatedTo(
source: Type,
target: Type,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
errorNode: Node | undefined,
headMessage?: DiagnosticMessage,
containingMessageChain?: () => DiagnosticMessageChain | undefined,
@ -18041,7 +18041,7 @@ namespace ts {
* To improve caching, the relation key for two generic types uses the target's id plus ids of the type parameters.
* For other cases, the types ids are used.
*/
function getRelationKey(source: Type, target: Type, intersectionState: IntersectionState, relation: Map<string, RelationComparisonResult>) {
function getRelationKey(source: Type, target: Type, intersectionState: IntersectionState, relation: ESMap<string, RelationComparisonResult>) {
if (relation === identityRelation && source.id > target.id) {
const temp = source;
source = target;
@ -19225,7 +19225,7 @@ namespace ts {
function inferTypes(inferences: InferenceInfo[], originalSource: Type, originalTarget: Type, priority: InferencePriority = 0, contravariant = false) {
let symbolOrTypeStack: (Symbol | Type)[];
let visited: Map<string, number>;
let visited: ESMap<string, number>;
let bivariant = false;
let propagationType: Type;
let inferencePriority = InferencePriority.MaxValue;
@ -25919,7 +25919,7 @@ namespace ts {
function checkApplicableSignatureForJsxOpeningLikeElement(
node: JsxOpeningLikeElement,
signature: Signature,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
checkMode: CheckMode,
reportErrors: boolean,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
@ -26019,7 +26019,7 @@ namespace ts {
node: CallLikeExpression,
args: readonly Expression[],
signature: Signature,
relation: Map<string, RelationComparisonResult>,
relation: ESMap<string, RelationComparisonResult>,
checkMode: CheckMode,
reportErrors: boolean,
containingMessageChain: (() => DiagnosticMessageChain | undefined) | undefined,
@ -26543,7 +26543,7 @@ namespace ts {
return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
function chooseOverload(candidates: Signature[], relation: Map<string, RelationComparisonResult>, signatureHelpTrailingComma = false) {
function chooseOverload(candidates: Signature[], relation: ESMap<string, RelationComparisonResult>, signatureHelpTrailingComma = false) {
candidatesForArgumentError = undefined;
candidateForArgumentArityError = undefined;
candidateForTypeArgumentError = undefined;
@ -32283,7 +32283,7 @@ namespace ts {
return !(getMergedSymbol(typeParameter.symbol).isReferenced! & SymbolFlags.TypeParameter) && !isIdentifierThatStartsWithUnderscore(typeParameter.name);
}
function addToGroup<K, V>(map: Map<string, [K, V[]]>, key: K, value: V, getKey: (key: K) => number | string): void {
function addToGroup<K, V>(map: ESMap<string, [K, V[]]>, key: K, value: V, getKey: (key: K) => number | string): void {
const keyString = String(getKey(key));
const group = map.get(keyString);
if (group) {
@ -37174,7 +37174,7 @@ namespace ts {
// this variable and functions that use it are deliberately moved here from the outer scope
// to avoid scope pollution
const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();
let fileToDirective: Map<string, string>;
let fileToDirective: ESMap<string, string>;
if (resolvedTypeReferenceDirectives) {
// populate reverse mapping: file path -> type reference directive that was resolved to this file
fileToDirective = createMap<string>();

View File

@ -1090,8 +1090,8 @@ namespace ts {
/* @internal */
export interface OptionsNameMap {
optionsNameMap: Map<string, CommandLineOption>;
shortOptionNames: Map<string, string>;
optionsNameMap: ESMap<string, CommandLineOption>;
shortOptionNames: ESMap<string, string>;
}
/*@internal*/
@ -1469,7 +1469,7 @@ namespace ts {
configFileName: string,
optionsToExtend: CompilerOptions,
host: ParseConfigFileHost,
extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>,
extendedConfigCache?: Map<ExtendedConfigCacheEntry>,
watchOptionsToExtend?: WatchOptions,
extraFileExtensions?: readonly FileExtensionInfo[],
): ParsedCommandLine | undefined {
@ -1562,15 +1562,15 @@ namespace ts {
optionTypeMismatchDiagnostic: Diagnostics.Watch_option_0_requires_a_value_of_type_1
};
let commandLineCompilerOptionsMapCache: Map<string, CommandLineOption>;
let commandLineCompilerOptionsMapCache: ESMap<string, CommandLineOption>;
function getCommandLineCompilerOptionsMap() {
return commandLineCompilerOptionsMapCache || (commandLineCompilerOptionsMapCache = commandLineOptionsToMap(optionDeclarations));
}
let commandLineWatchOptionsMapCache: Map<string, CommandLineOption>;
let commandLineWatchOptionsMapCache: ESMap<string, CommandLineOption>;
function getCommandLineWatchOptionsMap() {
return commandLineWatchOptionsMapCache || (commandLineWatchOptionsMapCache = commandLineOptionsToMap(optionsForWatch));
}
let commandLineTypeAcquisitionMapCache: Map<string, CommandLineOption>;
let commandLineTypeAcquisitionMapCache: ESMap<string, CommandLineOption>;
function getCommandLineTypeAcquisitionMap() {
return commandLineTypeAcquisitionMapCache || (commandLineTypeAcquisitionMapCache = commandLineOptionsToMap(typeAcquisitionDeclarations));
}
@ -1703,13 +1703,13 @@ namespace ts {
return convertPropertyValueToJson(sourceFile.statements[0].expression, knownRootOptions);
function isRootOptionMap(knownOptions: Map<string, CommandLineOption> | undefined) {
function isRootOptionMap(knownOptions: ESMap<string, CommandLineOption> | undefined) {
return knownRootOptions && (knownRootOptions as TsConfigOnlyOption).elementOptions === knownOptions;
}
function convertObjectLiteralExpressionToJson(
node: ObjectLiteralExpression,
knownOptions: Map<string, CommandLineOption> | undefined,
knownOptions: ESMap<string, CommandLineOption> | undefined,
extraKeyDiagnostics: DidYouMeanOptionsDiagnostics | undefined,
parentOption: string | undefined
): any {
@ -1964,7 +1964,7 @@ namespace ts {
return config;
}
function optionMapToObject(optionMap: Map<string, CompilerOptionsValue>): object {
function optionMapToObject(optionMap: ESMap<string, CompilerOptionsValue>): object {
return {
...arrayFrom(optionMap.entries()).reduce((prev, cur) => ({ ...prev, [cur[0]]: cur[1] }), {}),
};
@ -1994,7 +1994,7 @@ namespace ts {
return _ => true;
}
function getCustomTypeMapOfCommandLineOption(optionDefinition: CommandLineOption): Map<string, string | number> | undefined {
function getCustomTypeMapOfCommandLineOption(optionDefinition: CommandLineOption): ESMap<string, string | number> | undefined {
if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean" || optionDefinition.type === "object") {
// this is of a type CommandLineOptionOfPrimitiveType
return undefined;
@ -2007,7 +2007,7 @@ namespace ts {
}
}
function getNameOfCompilerOptionValue(value: CompilerOptionsValue, customTypeMap: Map<string, string | number>): string | undefined {
function getNameOfCompilerOptionValue(value: CompilerOptionsValue, customTypeMap: ESMap<string, string | number>): string | undefined {
// There is a typeMap associated with this command-line option so use it to map value back to its name
return forEachEntry(customTypeMap, (mapValue, key) => {
if (mapValue === value) {
@ -2019,7 +2019,7 @@ namespace ts {
function serializeCompilerOptions(
options: CompilerOptions,
pathOptions?: { configFilePath: string, useCaseSensitiveFileNames: boolean }
): Map<string, CompilerOptionsValue> {
): ESMap<string, CompilerOptionsValue> {
return serializeOptionBaseObject(options, getOptionsNameMap(), pathOptions);
}
@ -2031,7 +2031,7 @@ namespace ts {
options: OptionsBase,
{ optionsNameMap }: OptionsNameMap,
pathOptions?: { configFilePath: string, useCaseSensitiveFileNames: boolean }
): Map<string, CompilerOptionsValue> {
): ESMap<string, CompilerOptionsValue> {
const result = createMap<CompilerOptionsValue>();
const getCanonicalFileName = pathOptions && createGetCanonicalFileName(pathOptions.useCaseSensitiveFileNames);
@ -2220,7 +2220,7 @@ namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine {
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine {
return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
@ -2231,7 +2231,7 @@ namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine {
export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine {
return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
@ -2271,7 +2271,7 @@ namespace ts {
configFileName?: string,
resolutionStack: Path[] = [],
extraFileExtensions: readonly FileExtensionInfo[] = [],
extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>
extendedConfigCache?: ESMap<string, ExtendedConfigCacheEntry>
): ParsedCommandLine {
Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
const errors: Diagnostic[] = [];
@ -2456,7 +2456,7 @@ namespace ts {
configFileName: string | undefined,
resolutionStack: string[],
errors: Push<Diagnostic>,
extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>
extendedConfigCache?: ESMap<string, ExtendedConfigCacheEntry>
): ParsedTsconfig {
basePath = normalizeSlashes(basePath);
const resolvedPath = getNormalizedAbsolutePath(configFileName || "", basePath);
@ -2645,7 +2645,7 @@ namespace ts {
basePath: string,
resolutionStack: string[],
errors: Push<Diagnostic>,
extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>
extendedConfigCache?: ESMap<string, ExtendedConfigCacheEntry>
): ParsedTsconfig | undefined {
const path = host.useCaseSensitiveFileNames ? extendedConfigPath : toFileNameLowerCase(extendedConfigPath);
let value: ExtendedConfigCacheEntry | undefined;
@ -2750,11 +2750,11 @@ namespace ts {
return convertOptionsFromJson(getCommandLineWatchOptionsMap(), jsonOptions, basePath, /*defaultOptions*/ undefined, watchOptionsDidYouMeanDiagnostics, errors);
}
function convertOptionsFromJson(optionsNameMap: Map<string, CommandLineOption>, jsonOptions: any, basePath: string,
function convertOptionsFromJson(optionsNameMap: ESMap<string, CommandLineOption>, jsonOptions: any, basePath: string,
defaultOptions: undefined, diagnostics: DidYouMeanOptionsDiagnostics, errors: Push<Diagnostic>): WatchOptions | undefined;
function convertOptionsFromJson(optionsNameMap: Map<string, CommandLineOption>, jsonOptions: any, basePath: string,
function convertOptionsFromJson(optionsNameMap: ESMap<string, CommandLineOption>, jsonOptions: any, basePath: string,
defaultOptions: CompilerOptions | TypeAcquisition, diagnostics: DidYouMeanOptionsDiagnostics, errors: Push<Diagnostic>): CompilerOptions | TypeAcquisition;
function convertOptionsFromJson(optionsNameMap: Map<string, CommandLineOption>, jsonOptions: any, basePath: string,
function convertOptionsFromJson(optionsNameMap: ESMap<string, CommandLineOption>, jsonOptions: any, basePath: string,
defaultOptions: CompilerOptions | TypeAcquisition | WatchOptions | undefined, diagnostics: DidYouMeanOptionsDiagnostics, errors: Push<Diagnostic>) {
if (!jsonOptions) {
@ -3174,7 +3174,7 @@ namespace ts {
* @param extensionPriority The priority of the extension.
* @param context The expansion context.
*/
function hasFileWithHigherPriorityExtension(file: string, literalFiles: Map<string, string>, wildcardFiles: Map<string, string>, extensions: readonly string[], keyMapper: (value: string) => string) {
function hasFileWithHigherPriorityExtension(file: string, literalFiles: ESMap<string, string>, wildcardFiles: ESMap<string, string>, extensions: readonly string[], keyMapper: (value: string) => string) {
const extensionPriority = getExtensionPriority(file, extensions);
const adjustedExtensionPriority = adjustExtensionPriority(extensionPriority, extensions);
for (let i = ExtensionPriority.Highest; i < adjustedExtensionPriority; i++) {
@ -3196,7 +3196,7 @@ namespace ts {
* @param extensionPriority The priority of the extension.
* @param context The expansion context.
*/
function removeWildcardFilesWithLowerPriorityExtension(file: string, wildcardFiles: Map<string, string>, extensions: readonly string[], keyMapper: (value: string) => string) {
function removeWildcardFilesWithLowerPriorityExtension(file: string, wildcardFiles: ESMap<string, string>, extensions: readonly string[], keyMapper: (value: string) => string) {
const extensionPriority = getExtensionPriority(file, extensions);
const nextExtensionPriority = getNextLowestExtensionPriority(extensionPriority, extensions);
for (let i = nextExtensionPriority; i < extensions.length; i++) {

View File

@ -1,7 +1,7 @@
/* @internal */
namespace ts {
type GetIteratorCallback = <I extends readonly any[] | ReadonlySet<any> | ReadonlyMap<any, any> | undefined>(iterable: I) => Iterator<
I extends ReadonlyMap<infer K, infer V> ? [K, V] :
type GetIteratorCallback = <I extends readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined>(iterable: I) => Iterator<
I extends ReadonlyESMap<infer K, infer V> ? [K, V] :
I extends ReadonlySet<infer T> ? T :
I extends readonly (infer T)[] ? T :
I extends undefined ? undefined :
@ -20,17 +20,17 @@ namespace ts {
export const Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim");
export const Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim");
export function getIterator<I extends readonly any[] | ReadonlySet<any> | ReadonlyMap<any, any> | undefined>(iterable: I): Iterator<
I extends ReadonlyMap<infer K, infer V> ? [K, V] :
export function getIterator<I extends readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined>(iterable: I): Iterator<
I extends ReadonlyESMap<infer K, infer V> ? [K, V] :
I extends ReadonlySet<infer T> ? T :
I extends readonly (infer T)[] ? T :
I extends undefined ? undefined :
never>;
export function getIterator<K, V>(iterable: ReadonlyMap<K, V>): Iterator<[K, V]>;
export function getIterator<K, V>(iterable: ReadonlyMap<K, V> | undefined): Iterator<[K, V]> | undefined;
export function getIterator<K, V>(iterable: ReadonlyESMap<K, V>): Iterator<[K, V]>;
export function getIterator<K, V>(iterable: ReadonlyESMap<K, V> | undefined): Iterator<[K, V]> | undefined;
export function getIterator<T>(iterable: readonly T[] | ReadonlySet<T>): Iterator<T>;
export function getIterator<T>(iterable: readonly T[] | ReadonlySet<T> | undefined): Iterator<T> | undefined;
export function getIterator(iterable: readonly any[] | ReadonlySet<any> | ReadonlyMap<any, any> | undefined): Iterator<any> | undefined {
export function getIterator(iterable: readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined): Iterator<any> | undefined {
if (iterable) {
if (isArray(iterable)) return arrayIterator(iterable);
if (iterable instanceof Map) return iterable.entries();
@ -42,15 +42,15 @@ namespace ts {
export const emptyArray: never[] = [] as never[];
/** Create a new map. */
export function createMap<K, V>(): Map<K, V>;
export function createMap<T>(): Map<string, T>;
export function createMap<K, V>(): Map<K, V> {
export function createMap<K, V>(): ESMap<K, V>;
export function createMap<T>(): ESMap<string, T>;
export function createMap<K, V>(): ESMap<K, V> {
return new Map<K, V>();
}
/** Create a new map from a template object is provided, the map will copy entries from it. */
export function createMapFromTemplate<T>(template: MapLike<T>): Map<string, T> {
const map: Map<string, T> = new Map<string, T>();
export function createMapFromTemplate<T>(template: MapLike<T>): ESMap<string, T> {
const map: ESMap<string, T> = new Map<string, T>();
// Copies keys/values from template. Note that for..in will not throw if
// template is undefined, and instead will just exit the loop.
@ -160,7 +160,7 @@ namespace ts {
};
}
export function zipToMap<K, V>(keys: readonly K[], values: readonly V[]): Map<K, V> {
export function zipToMap<K, V>(keys: readonly K[], values: readonly V[]): ESMap<K, V> {
Debug.assert(keys.length === values.length);
const map = new Map<K, V>();
for (let i = 0; i < keys.length; ++i) {
@ -554,9 +554,9 @@ namespace ts {
};
}
export function mapDefinedEntries<K1, V1, K2, V2>(map: ReadonlyMap<K1, V1>, f: (key: K1, value: V1) => readonly [K2, V2] | undefined): Map<K2, V2>;
export function mapDefinedEntries<K1, V1, K2, V2>(map: ReadonlyMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2 | undefined, V2 | undefined] | undefined): Map<K2, V2> | undefined;
export function mapDefinedEntries<K1, V1, K2, V2>(map: ReadonlyMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2 | undefined, V2 | undefined] | undefined): Map<K2, V2> | undefined {
export function mapDefinedEntries<K1, V1, K2, V2>(map: ReadonlyESMap<K1, V1>, f: (key: K1, value: V1) => readonly [K2, V2] | undefined): ESMap<K2, V2>;
export function mapDefinedEntries<K1, V1, K2, V2>(map: ReadonlyESMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2 | undefined, V2 | undefined] | undefined): ESMap<K2, V2> | undefined;
export function mapDefinedEntries<K1, V1, K2, V2>(map: ReadonlyESMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2 | undefined, V2 | undefined] | undefined): ESMap<K2, V2> | undefined {
if (!map) {
return undefined;
}
@ -660,9 +660,9 @@ namespace ts {
return result;
}
export function mapEntries<K1, V1, K2, V2>(map: ReadonlyMap<K1, V1>, f: (key: K1, value: V1) => readonly [K2, V2]): Map<K2, V2>;
export function mapEntries<K1, V1, K2, V2>(map: ReadonlyMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2, V2]): Map<K2, V2> | undefined;
export function mapEntries<K1, V1, K2, V2>(map: ReadonlyMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2, V2]): Map<K2, V2> | undefined {
export function mapEntries<K1, V1, K2, V2>(map: ReadonlyESMap<K1, V1>, f: (key: K1, value: V1) => readonly [K2, V2]): ESMap<K2, V2>;
export function mapEntries<K1, V1, K2, V2>(map: ReadonlyESMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2, V2]): ESMap<K2, V2> | undefined;
export function mapEntries<K1, V1, K2, V2>(map: ReadonlyESMap<K1, V1> | undefined, f: (key: K1, value: V1) => readonly [K2, V2]): ESMap<K2, V2> | undefined {
if (!map) {
return undefined;
}
@ -1342,11 +1342,11 @@ namespace ts {
* the same key with the given 'makeKey' function, then the element with the higher
* index in the array will be the one associated with the produced key.
*/
export function arrayToMap<K, V>(array: readonly V[], makeKey: (value: V) => K | undefined): Map<K, V>;
export function arrayToMap<K, V1, V2>(array: readonly V1[], makeKey: (value: V1) => K | undefined, makeValue: (value: V1) => V2): Map<K, V2>;
export function arrayToMap<T>(array: readonly T[], makeKey: (value: T) => string | undefined): Map<string, T>;
export function arrayToMap<T, U>(array: readonly T[], makeKey: (value: T) => string | undefined, makeValue: (value: T) => U): Map<string, U>;
export function arrayToMap<K, V1, V2>(array: readonly V1[], makeKey: (value: V1) => K | undefined, makeValue: (value: V1) => V1 | V2 = identity): Map<K, V1 | V2> {
export function arrayToMap<K, V>(array: readonly V[], makeKey: (value: V) => K | undefined): ESMap<K, V>;
export function arrayToMap<K, V1, V2>(array: readonly V1[], makeKey: (value: V1) => K | undefined, makeValue: (value: V1) => V2): ESMap<K, V2>;
export function arrayToMap<T>(array: readonly T[], makeKey: (value: T) => string | undefined): ESMap<string, T>;
export function arrayToMap<T, U>(array: readonly T[], makeKey: (value: T) => string | undefined, makeValue: (value: T) => U): ESMap<string, U>;
export function arrayToMap<K, V1, V2>(array: readonly V1[], makeKey: (value: V1) => K | undefined, makeValue: (value: V1) => V1 | V2 = identity): ESMap<K, V1 | V2> {
const result = new Map<K, V1 | V2>();
for (const value of array) {
const key = makeKey(value);
@ -1425,7 +1425,7 @@ namespace ts {
return fn ? fn.bind(obj) : undefined;
}
export interface MultiMap<K, V> extends Map<K, V[]> {
export interface MultiMap<K, V> extends ESMap<K, V[]> {
/**
* Adds the value to an array of values associated with the key, and returns the array.
* Creates the array if it does not already exist.

View File

@ -36,22 +36,36 @@ namespace ts {
}
/** ES6 Map interface, only read methods included. */
export interface ReadonlyMap<K, V> extends ReadonlyCollection<K> {
export interface ReadonlyESMap<K, V> extends ReadonlyCollection<K> {
get(key: K): V | undefined;
values(): Iterator<V>;
entries(): Iterator<[K, V]>;
forEach(action: (value: V, key: K) => void): void;
}
/**
* ES6 Map interface, only read methods included.
* @deprecated Use `ts.ReadonlyESMap<K, V>` instead.
*/
export interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
}
/** ES6 Map interface. */
export interface Map<K, V> extends ReadonlyMap<K, V>, Collection<K> {
export interface ESMap<K, V> extends ReadonlyESMap<K, V>, Collection<K> {
set(key: K, value: V): this;
}
/**
* ES6 Map interface.
* @deprecated Use `ts.ESMap<K, V>` instead.
*/
export interface Map<T> extends ESMap<string, T> {
}
/* @internal */
export interface MapConstructor {
// eslint-disable-next-line @typescript-eslint/prefer-function-type
new <K, V>(iterable?: readonly (readonly [K, V])[] | ReadonlyMap<K, V>): Map<K, V>;
new <K, V>(iterable?: readonly (readonly [K, V])[] | ReadonlyESMap<K, V>): ESMap<K, V>;
}
/** ES6 Set interface, only read methods included. */

View File

@ -841,7 +841,7 @@ namespace ts {
};`
};
let allUnscopedEmitHelpers: ReadonlyMap<string, UnscopedEmitHelper> | undefined;
let allUnscopedEmitHelpers: ReadonlyESMap<string, UnscopedEmitHelper> | undefined;
export function getAllUnscopedEmitHelpers() {
return allUnscopedEmitHelpers || (allUnscopedEmitHelpers = arrayToMap([

View File

@ -442,8 +442,8 @@ namespace ts {
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
*/
export interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<string, ResolvedModuleWithFailedLookupLocations>;
/*@internal*/ directoryToModuleNameMap: CacheWithRedirects<Map<string, ResolvedModuleWithFailedLookupLocations>>;
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<ResolvedModuleWithFailedLookupLocations>;
/*@internal*/ directoryToModuleNameMap: CacheWithRedirects<ESMap<string, ResolvedModuleWithFailedLookupLocations>>;
}
/**
@ -472,18 +472,18 @@ namespace ts {
/*@internal*/
export interface CacheWithRedirects<T> {
ownMap: Map<string, T>;
redirectsMap: Map<Path, Map<string, T>>;
getOrCreateMapOfCacheRedirects(redirectedReference: ResolvedProjectReference | undefined): Map<string, T>;
ownMap: ESMap<string, T>;
redirectsMap: ESMap<Path, ESMap<string, T>>;
getOrCreateMapOfCacheRedirects(redirectedReference: ResolvedProjectReference | undefined): ESMap<string, T>;
clear(): void;
setOwnOptions(newOptions: CompilerOptions): void;
setOwnMap(newOwnMap: Map<string, T>): void;
setOwnMap(newOwnMap: ESMap<string, T>): void;
}
/*@internal*/
export function createCacheWithRedirects<T>(options?: CompilerOptions): CacheWithRedirects<T> {
let ownMap: Map<string, T> = createMap();
const redirectsMap = new Map<Path, Map<string, T>>();
let ownMap: ESMap<string, T> = createMap();
const redirectsMap = new Map<Path, ESMap<string, T>>();
return {
ownMap,
redirectsMap,
@ -497,7 +497,7 @@ namespace ts {
options = newOptions;
}
function setOwnMap(newOwnMap: Map<string, T>) {
function setOwnMap(newOwnMap: ESMap<string, T>) {
ownMap = newOwnMap;
}
@ -523,7 +523,7 @@ namespace ts {
/*@internal*/
export function createModuleResolutionCacheWithMaps(
directoryToModuleNameMap: CacheWithRedirects<Map<string, ResolvedModuleWithFailedLookupLocations>>,
directoryToModuleNameMap: CacheWithRedirects<ESMap<string, ResolvedModuleWithFailedLookupLocations>>,
moduleNameToDirectoryMap: CacheWithRedirects<PerModuleNameCache>,
currentDirectory: string,
getCanonicalFileName: GetCanonicalFileName): ModuleResolutionCache {
@ -532,7 +532,7 @@ namespace ts {
function getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference) {
const path = toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache<Map<string, ResolvedModuleWithFailedLookupLocations>>(directoryToModuleNameMap, redirectedReference, path, createMap);
return getOrCreateCache<ESMap<string, ResolvedModuleWithFailedLookupLocations>>(directoryToModuleNameMap, redirectedReference, path, createMap);
}
function getOrCreateCacheForModuleName(nonRelativeModuleName: string, redirectedReference?: ResolvedProjectReference): PerModuleNameCache {

View File

@ -722,8 +722,8 @@ namespace ts {
let currentToken: SyntaxKind;
let nodeCount: number;
let identifiers: Map<string, string>;
let privateIdentifiers: Map<string, string>;
let identifiers: ESMap<string, string>;
let privateIdentifiers: ESMap<string, string>;
let identifierCount: number;
let parsingContext: ParsingContext;

View File

@ -8,9 +8,9 @@ namespace ts.performance {
let enabled = false;
let profilerStart = 0;
let counts: Map<string, number>;
let marks: Map<string, number>;
let measures: Map<string, number>;
let counts: ESMap<string, number>;
let marks: ESMap<string, number>;
let measures: ESMap<string, number>;
export interface Timer {
enter(): void;

View File

@ -126,7 +126,7 @@ namespace ts {
}
}
let outputFingerprints: Map<string, OutputFingerprint>;
let outputFingerprints: ESMap<string, OutputFingerprint>;
function writeFileWorker(fileName: string, data: string, writeByteOrderMark: boolean) {
if (!isWatchSet(options) || !system.createHash || !system.getModifiedTime) {
system.writeFile(fileName, data, writeByteOrderMark);
@ -533,7 +533,7 @@ namespace ts {
export const inferredTypesContainingFile = "__inferred type names__.ts";
interface DiagnosticCache<T extends Diagnostic> {
perFile?: Map<Path, readonly T[]>;
perFile?: ESMap<Path, readonly T[]>;
allDiagnostics?: readonly T[];
}
@ -702,7 +702,7 @@ namespace ts {
let processingDefaultLibFiles: SourceFile[] | undefined;
let processingOtherFiles: SourceFile[] | undefined;
let files: SourceFile[];
let symlinks: ReadonlyMap<string, string> | undefined;
let symlinks: ReadonlyESMap<string, string> | undefined;
let commonSourceDirectory: string;
let diagnosticsProducingTypeChecker: TypeChecker;
let noDiagnosticsTypeChecker: TypeChecker;
@ -803,9 +803,9 @@ namespace ts {
// A parallel array to projectReferences storing the results of reading in the referenced tsconfig files
let resolvedProjectReferences: readonly (ResolvedProjectReference | undefined)[] | undefined;
let projectReferenceRedirects: Map<Path, ResolvedProjectReference | false> | undefined;
let mapFromFileToProjectReferenceRedirects: Map<Path, Path> | undefined;
let mapFromToProjectReferenceRedirectSource: Map<Path, SourceOfProjectReferenceRedirect> | undefined;
let projectReferenceRedirects: ESMap<Path, ResolvedProjectReference | false> | undefined;
let mapFromFileToProjectReferenceRedirects: ESMap<Path, Path> | undefined;
let mapFromToProjectReferenceRedirectSource: ESMap<Path, SourceOfProjectReferenceRedirect> | undefined;
const useSourceOfProjectReferenceRedirect = !!host.useSourceOfProjectReferenceRedirect?.() &&
!options.disableSourceOfProjectReferenceRedirect;
@ -3452,7 +3452,7 @@ namespace ts {
return comparePaths(file1, file2, currentDirectory, !host.useCaseSensitiveFileNames()) === Comparison.EqualTo;
}
function getProbableSymlinks(): ReadonlyMap<string, string> {
function getProbableSymlinks(): ReadonlyESMap<string, string> {
if (host.getSymlinks) {
return host.getSymlinks();
}
@ -3479,8 +3479,8 @@ namespace ts {
function updateHostForUseSourceOfProjectReferenceRedirect(host: HostForUseSourceOfProjectReferenceRedirect) {
let setOfDeclarationDirectories: Set<Path> | undefined;
let symlinkedDirectories: Map<Path, SymlinkedDirectory | false> | undefined;
let symlinkedFiles: Map<Path, string> | undefined;
let symlinkedDirectories: ESMap<Path, SymlinkedDirectory | false> | undefined;
let symlinkedFiles: ESMap<Path, string> | undefined;
const originalFileExists = host.compilerHost.fileExists;
const originalDirectoryExists = host.compilerHost.directoryExists;

View File

@ -13,7 +13,7 @@ namespace ts {
invalidateResolutionOfFile(filePath: Path): void;
removeResolutionsOfFile(filePath: Path): void;
removeResolutionsFromProjectReferenceRedirects(filePath: Path): void;
setFilesWithInvalidatedNonRelativeUnresolvedImports(filesWithUnresolvedImports: Map<Path, readonly string[]>): void;
setFilesWithInvalidatedNonRelativeUnresolvedImports(filesWithUnresolvedImports: ESMap<Path, readonly string[]>): void;
createHasInvalidatedResolution(forceAllFilesAsInvalidated?: boolean): HasInvalidatedResolution;
hasChangedAutomaticTypeDirectiveNames(): boolean;
@ -144,7 +144,7 @@ namespace ts {
export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootDirForResolution: string | undefined, logChangesWhenResolvingModule: boolean): ResolutionCache {
let filesWithChangedSetOfUnresolvedImports: Path[] | undefined;
let filesWithInvalidatedResolutions: Set<Path> | undefined;
let filesWithInvalidatedNonRelativeUnresolvedImports: ReadonlyMap<Path, readonly string[]> | undefined;
let filesWithInvalidatedNonRelativeUnresolvedImports: ReadonlyESMap<Path, readonly string[]> | undefined;
const nonRelativeExternalModuleResolutions = createMultiMap<ResolutionWithFailedLookupLocations>();
const resolutionsWithFailedLookups: ResolutionWithFailedLookupLocations[] = [];
@ -161,8 +161,8 @@ namespace ts {
// The resolvedModuleNames and resolvedTypeReferenceDirectives are the cache of resolutions per file.
// The key in the map is source file's path.
// The values are Map of resolutions with key being name lookedup.
const resolvedModuleNames = new Map<Path, Map<string, CachedResolvedModuleWithFailedLookupLocations>>();
const perDirectoryResolvedModuleNames: CacheWithRedirects<Map<string, CachedResolvedModuleWithFailedLookupLocations>> = createCacheWithRedirects();
const resolvedModuleNames = new Map<Path, ESMap<string, CachedResolvedModuleWithFailedLookupLocations>>();
const perDirectoryResolvedModuleNames: CacheWithRedirects<ESMap<string, CachedResolvedModuleWithFailedLookupLocations>> = createCacheWithRedirects();
const nonRelativeModuleNameCache: CacheWithRedirects<PerModuleNameCache> = createCacheWithRedirects();
const moduleResolutionCache = createModuleResolutionCacheWithMaps(
perDirectoryResolvedModuleNames,
@ -171,8 +171,8 @@ namespace ts {
resolutionHost.getCanonicalFileName
);
const resolvedTypeReferenceDirectives = new Map<Path, Map<string, CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations>>();
const perDirectoryResolvedTypeReferenceDirectives: CacheWithRedirects<Map<string, CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations>> = createCacheWithRedirects();
const resolvedTypeReferenceDirectives = new Map<Path, ESMap<string, CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations>>();
const perDirectoryResolvedTypeReferenceDirectives: CacheWithRedirects<ESMap<string, CachedResolvedTypeReferenceDirectiveWithFailedLookupLocations>> = createCacheWithRedirects();
/**
* These are the extensions that failed lookup files will have by default,
@ -334,8 +334,8 @@ namespace ts {
names: readonly string[];
containingFile: string;
redirectedReference: ResolvedProjectReference | undefined;
cache: Map<Path, Map<string, T>>;
perDirectoryCacheWithRedirects: CacheWithRedirects<Map<string, T>>;
cache: ESMap<Path, ESMap<string, T>>;
perDirectoryCacheWithRedirects: CacheWithRedirects<ESMap<string, T>>;
loader: (name: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference) => T;
getResolutionWithResolvedFileName: GetResolutionWithResolvedFileName<T, R>;
shouldRetryResolution: (t: T) => boolean;
@ -684,7 +684,7 @@ namespace ts {
}
function removeResolutionsOfFileFromCache<T extends ResolutionWithFailedLookupLocations, R extends ResolutionWithResolvedFileName>(
cache: Map<string, Map<string, T>>,
cache: ESMap<string, ESMap<string, T>>,
filePath: Path,
getResolutionWithResolvedFileName: GetResolutionWithResolvedFileName<T, R>,
) {
@ -741,7 +741,7 @@ namespace ts {
}
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap: ReadonlyMap<Path, readonly string[]>) {
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap: ReadonlyESMap<Path, readonly string[]>) {
Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
}

View File

@ -330,7 +330,7 @@ namespace ts {
lookupInUnicodeMap(code, unicodeES3IdentifierPart);
}
function makeReverseMap(source: Map<string, number>): string[] {
function makeReverseMap(source: ESMap<string, number>): string[] {
const result: string[] = [];
source.forEach((value, name) => {
result[value] = name;

View File

@ -16,7 +16,7 @@ namespace ts {
let sourcesContent: (string | null)[] | undefined;
const names: string[] = [];
let nameToNameIndexMap: Map<string, number> | undefined;
let nameToNameIndexMap: ESMap<string, number> | undefined;
let mappings = "";
// Last recorded and encoded mappings

View File

@ -538,7 +538,7 @@ namespace ts {
};
}
type InvokeMap = Map<Path, string[] | true>;
type InvokeMap = ESMap<Path, string[] | true>;
function invokeCallbacks(dirPath: Path, fileName: string): void;
function invokeCallbacks(dirPath: Path, invokeMap: InvokeMap, fileNames: string[] | undefined): void;
function invokeCallbacks(dirPath: Path, fileNameOrInvokeMap: string | InvokeMap, fileNames?: string[]) {

View File

@ -60,7 +60,7 @@ namespace ts {
let enclosingDeclaration: Node;
let necessaryTypeReferences: Set<string> | undefined;
let lateMarkedStatements: LateVisibilityPaintedStatement[] | undefined;
let lateStatementReplacementMap: Map<string, VisitResult<LateVisibilityPaintedStatement | ExportAssignment>>;
let lateStatementReplacementMap: ESMap<string, VisitResult<LateVisibilityPaintedStatement | ExportAssignment>>;
let suppressNewDiagnosticContexts: boolean;
let exportedModulesFromDeclarationEmit: Symbol[] | undefined;
@ -81,8 +81,8 @@ namespace ts {
let errorNameNode: DeclarationName | undefined;
let currentSourceFile: SourceFile;
let refs: Map<string, SourceFile>;
let libs: Map<string, boolean>;
let refs: ESMap<string, SourceFile>;
let libs: ESMap<string, boolean>;
let emittedImports: readonly AnyImportSyntax[] | undefined; // must be declared in container so it can be `undefined` while transformer's first pass
const resolver = context.getEmitResolver();
const options = context.getCompilerOptions();
@ -402,7 +402,7 @@ namespace ts {
}
}
function collectReferences(sourceFile: SourceFile | UnparsedSource, ret: Map<string, SourceFile>) {
function collectReferences(sourceFile: SourceFile | UnparsedSource, ret: ESMap<string, SourceFile>) {
if (noResolve || (!isUnparsedSource(sourceFile) && isSourceFileJS(sourceFile))) return ret;
forEach(sourceFile.referencedFiles, f => {
const elem = host.getSourceFileFromReference(sourceFile, f);
@ -413,7 +413,7 @@ namespace ts {
return ret;
}
function collectLibs(sourceFile: SourceFile | UnparsedSource, ret: Map<string, boolean>) {
function collectLibs(sourceFile: SourceFile | UnparsedSource, ret: ESMap<string, boolean>) {
forEach(sourceFile.libReferenceDirectives, ref => {
const lib = host.getLibFileFromReference(ref);
if (lib) {

View File

@ -72,15 +72,15 @@ namespace ts {
* set of labels that occurred inside the converted loop
* used to determine if labeled jump can be emitted as is or it should be dispatched to calling code
*/
labels?: Map<string, boolean>;
labels?: ESMap<string, boolean>;
/*
* collection of labeled jumps that transfer control outside the converted loop.
* maps store association 'label -> labelMarker' where
* - label - value of label as it appear in code
* - label marker - return value that should be interpreted by calling code as 'jump to <label>'
*/
labeledNonLocalBreaks?: Map<string, string>;
labeledNonLocalContinues?: Map<string, string>;
labeledNonLocalBreaks?: ESMap<string, string>;
labeledNonLocalContinues?: ESMap<string, string>;
/*
* set of non-labeled jumps that transfer control outside the converted loop
@ -3291,7 +3291,7 @@ namespace ts {
}
}
function processLabeledJumps(table: Map<string, string>, isBreak: boolean, loopResultName: Identifier, outerLoop: ConvertedLoopState | undefined, caseClauses: CaseClause[]): void {
function processLabeledJumps(table: ESMap<string, string>, isBreak: boolean, loopResultName: Identifier, outerLoop: ConvertedLoopState | undefined, caseClauses: CaseClause[]): void {
if (!table) {
return;
}

View File

@ -244,7 +244,7 @@ namespace ts {
const previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
let renamedCatchVariables: Map<string, boolean>;
let renamedCatchVariables: ESMap<string, boolean>;
let renamedCatchVariableDeclarations: Identifier[];
let inGeneratorFunctionBody: boolean;

View File

@ -13,7 +13,7 @@ namespace ts {
context.enableEmitNotification(SyntaxKind.SourceFile);
context.enableSubstitution(SyntaxKind.Identifier);
let helperNameSubstitutions: Map<string, Identifier> | undefined;
let helperNameSubstitutions: ESMap<string, Identifier> | undefined;
return chainBundle(context, transformSourceFile);
function transformSourceFile(node: SourceFile) {

View File

@ -8,7 +8,7 @@ namespace ts {
export interface ExternalModuleInfo {
externalImports: (ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration)[]; // imports of other external modules
externalHelpersImportDeclaration: ImportDeclaration | undefined; // import of external helpers
exportSpecifiers: Map<string, ExportSpecifier[]>; // file-local export specifiers by name (no reexports)
exportSpecifiers: ESMap<string, ExportSpecifier[]>; // file-local export specifiers by name (no reexports)
exportedBindings: Identifier[][]; // exported names of local declarations
exportedNames: Identifier[] | undefined; // all exported names in the module, both local and reexported
exportEquals: ExportAssignment | undefined; // an export= declaration if one was present
@ -219,7 +219,7 @@ namespace ts {
}
}
function collectExportedVariableInfo(decl: VariableDeclaration | BindingElement, uniqueExports: Map<string, boolean>, exportedNames: Identifier[] | undefined) {
function collectExportedVariableInfo(decl: VariableDeclaration | BindingElement, uniqueExports: ESMap<string, boolean>, exportedNames: Identifier[] | undefined) {
if (isBindingPattern(decl.name)) {
for (const element of decl.name.elements) {
if (!isOmittedExpression(element)) {

View File

@ -52,7 +52,7 @@ namespace ts {
/*@internal*/
export type ResolvedConfigFilePath = ResolvedConfigFileName & Path;
function getOrCreateValueFromConfigFileMap<T>(configFileMap: Map<ResolvedConfigFilePath, T>, resolved: ResolvedConfigFilePath, createT: () => T): T {
function getOrCreateValueFromConfigFileMap<T>(configFileMap: ESMap<ResolvedConfigFilePath, T>, resolved: ResolvedConfigFilePath, createT: () => T): T {
const existingValue = configFileMap.get(resolved);
let newValue: T | undefined;
if (!existingValue) {
@ -62,8 +62,8 @@ namespace ts {
return existingValue || newValue!;
}
function getOrCreateValueMapFromConfigFileMap<T>(configFileMap: Map<ResolvedConfigFilePath, Map<string, T>>, resolved: ResolvedConfigFilePath): Map<string, T> {
return getOrCreateValueFromConfigFileMap<Map<string, T>>(configFileMap, resolved, createMap);
function getOrCreateValueMapFromConfigFileMap<T>(configFileMap: ESMap<ResolvedConfigFilePath, ESMap<string, T>>, resolved: ResolvedConfigFilePath): ESMap<string, T> {
return getOrCreateValueFromConfigFileMap<ESMap<string, T>>(configFileMap, resolved, createMap);
}
function newer(date1: Date, date2: Date): Date {
@ -222,17 +222,17 @@ namespace ts {
readonly rootNames: readonly string[];
readonly baseWatchOptions: WatchOptions | undefined;
readonly resolvedConfigFilePaths: Map<string, ResolvedConfigFilePath>;
readonly configFileCache: Map<ResolvedConfigFilePath, ConfigFileCacheEntry>;
readonly resolvedConfigFilePaths: ESMap<string, ResolvedConfigFilePath>;
readonly configFileCache: ESMap<ResolvedConfigFilePath, ConfigFileCacheEntry>;
/** Map from config file name to up-to-date status */
readonly projectStatus: Map<ResolvedConfigFilePath, UpToDateStatus>;
readonly buildInfoChecked: Map<ResolvedConfigFilePath, true>;
readonly extendedConfigCache: Map<string, ExtendedConfigCacheEntry>;
readonly projectStatus: ESMap<ResolvedConfigFilePath, UpToDateStatus>;
readonly buildInfoChecked: ESMap<ResolvedConfigFilePath, true>;
readonly extendedConfigCache: ESMap<string, ExtendedConfigCacheEntry>;
readonly builderPrograms: Map<ResolvedConfigFilePath, T>;
readonly diagnostics: Map<ResolvedConfigFilePath, readonly Diagnostic[]>;
readonly projectPendingBuild: Map<ResolvedConfigFilePath, ConfigFileProgramReloadLevel>;
readonly projectErrorsReported: Map<ResolvedConfigFilePath, true>;
readonly builderPrograms: ESMap<ResolvedConfigFilePath, T>;
readonly diagnostics: ESMap<ResolvedConfigFilePath, readonly Diagnostic[]>;
readonly projectPendingBuild: ESMap<ResolvedConfigFilePath, ConfigFileProgramReloadLevel>;
readonly projectErrorsReported: ESMap<ResolvedConfigFilePath, true>;
readonly compilerHost: CompilerHost;
readonly moduleResolutionCache: ModuleResolutionCache | undefined;
@ -249,9 +249,9 @@ namespace ts {
// Watch state
readonly watch: boolean;
readonly allWatchedWildcardDirectories: Map<ResolvedConfigFilePath, Map<string, WildcardDirectoryWatcher>>;
readonly allWatchedInputFiles: Map<ResolvedConfigFilePath, Map<Path, FileWatcher>>;
readonly allWatchedConfigFiles: Map<ResolvedConfigFilePath, FileWatcher>;
readonly allWatchedWildcardDirectories: ESMap<ResolvedConfigFilePath, ESMap<string, WildcardDirectoryWatcher>>;
readonly allWatchedInputFiles: ESMap<ResolvedConfigFilePath, ESMap<Path, FileWatcher>>;
readonly allWatchedConfigFiles: ESMap<ResolvedConfigFilePath, FileWatcher>;
timerToBuildInvalidatedProject: any;
reportFileChangeDetected: boolean;
@ -442,7 +442,7 @@ namespace ts {
const currentProjects = arrayToSet(
getBuildOrderFromAnyBuildOrder(buildOrder),
resolved => toResolvedConfigFilePath(state, resolved)
) as Map<ResolvedConfigFilePath, true>;
) as ESMap<ResolvedConfigFilePath, true>;
const noopOnDelete = { onDeleteValue: noop };
// Config file cache
@ -976,7 +976,7 @@ namespace ts {
function finishEmit(
emitterDiagnostics: DiagnosticCollection,
emittedOutputs: Map<Path, string>,
emittedOutputs: ESMap<Path, string>,
priorNewestUpdateTime: Date,
newestDeclarationFileContentChangedTimeIsMaximumDate: boolean,
oldestOutputFileName: string,
@ -1544,7 +1544,7 @@ namespace ts {
return actual;
}
function updateOutputTimestampsWorker(state: SolutionBuilderState, proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: Map<Path, string>) {
function updateOutputTimestampsWorker(state: SolutionBuilderState, proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: ESMap<Path, string>) {
const { host } = state;
const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames());
if (!skipOutputs || outputs.length !== skipOutputs.size) {

View File

@ -3397,7 +3397,7 @@ namespace ts {
// this map is used by transpiler to supply alternative names for dependencies (i.e. in case of bundling)
/* @internal */
renamedDependencies?: ReadonlyMap<string, string>;
renamedDependencies?: ReadonlyESMap<string, string>;
/**
* lib.d.ts should have a reference comment like
@ -3423,7 +3423,7 @@ namespace ts {
// JS identifier-declarations that are intended to merge with globals
/* @internal */ jsGlobalAugmentations?: SymbolTable;
/* @internal */ identifiers: Map<string, string>; // Map from a string to an interned string
/* @internal */ identifiers: ESMap<string, string>; // Map from a string to an interned string
/* @internal */ nodeCount: number;
/* @internal */ identifierCount: number;
/* @internal */ symbolCount: number;
@ -3451,8 +3451,8 @@ namespace ts {
// Stores a mapping 'external module reference text' -> 'resolved file name' | undefined
// It is used to resolve module names in the checker.
// Content of this field should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
/* @internal */ resolvedModules?: Map<string, ResolvedModuleFull | undefined>;
/* @internal */ resolvedTypeReferenceDirectiveNames: Map<string, ResolvedTypeReferenceDirective | undefined>;
/* @internal */ resolvedModules?: ESMap<string, ResolvedModuleFull | undefined>;
/* @internal */ resolvedTypeReferenceDirectiveNames: ESMap<string, ResolvedTypeReferenceDirective | undefined>;
/* @internal */ imports: readonly StringLiteralLike[];
// Identifier only if `declare global`
/* @internal */ moduleAugmentations: readonly (StringLiteral | Identifier)[];
@ -3684,7 +3684,7 @@ namespace ts {
/* @internal */
getRefFileMap(): MultiMap<Path, RefFile> | undefined;
/* @internal */
getFilesByNameMap(): Map<string, SourceFile | false | undefined>;
getFilesByNameMap(): ESMap<string, SourceFile | false | undefined>;
/**
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
@ -3734,7 +3734,7 @@ namespace ts {
getRelationCacheSizes(): { assignable: number, identity: number, subtype: number, strictSubtype: number };
/* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection;
/* @internal */ getResolvedTypeReferenceDirectives(): Map<string, ResolvedTypeReferenceDirective | undefined>;
/* @internal */ getResolvedTypeReferenceDirectives(): ESMap<string, ResolvedTypeReferenceDirective | undefined>;
isSourceFileFromExternalLibrary(file: SourceFile): boolean;
isSourceFileDefaultLibrary(file: SourceFile): boolean;
@ -3745,7 +3745,7 @@ namespace ts {
/* @internal */ getLibFileFromReference(ref: FileReference): SourceFile | undefined;
/** Given a source file, get the name of the package it was imported from. */
/* @internal */ sourceFileToPackageName: Map<string, string>;
/* @internal */ sourceFileToPackageName: ESMap<string, string>;
/** Set of all source files that some other source file redirects to. */
/* @internal */ redirectTargetsMap: MultiMap<string, string>;
/** Is the file emitted file */
@ -3762,7 +3762,7 @@ namespace ts {
/*@internal*/ isSourceOfProjectReferenceRedirect(fileName: string): boolean;
/*@internal*/ getProgramBuildInfo?(): ProgramBuildInfo | undefined;
/*@internal*/ emitBuildInfo(writeFile?: WriteFileCallback, cancellationToken?: CancellationToken): EmitResult;
/*@internal*/ getProbableSymlinks(): ReadonlyMap<string, string>;
/*@internal*/ getProbableSymlinks(): ReadonlyESMap<string, string>;
/**
* This implementation handles file exists to be true if file is source of project reference redirect when program is created using useSourceOfProjectReferenceRedirect
*/
@ -3774,7 +3774,7 @@ namespace ts {
}
/* @internal */
export type RedirectTargetsMap = ReadonlyMap<string, readonly string[]>;
export type RedirectTargetsMap = ReadonlyESMap<string, readonly string[]>;
export interface ResolvedProjectReference {
commandLine: ParsedCommandLine;
@ -3870,7 +3870,7 @@ namespace ts {
getSourceFiles(): readonly SourceFile[];
getSourceFile(fileName: string): SourceFile | undefined;
getResolvedTypeReferenceDirectives(): ReadonlyMap<string, ResolvedTypeReferenceDirective | undefined>;
getResolvedTypeReferenceDirectives(): ReadonlyESMap<string, ResolvedTypeReferenceDirective | undefined>;
getProjectReferenceRedirect(fileName: string): string | undefined;
isSourceOfProjectReferenceRedirect(fileName: string): boolean;
@ -4591,7 +4591,7 @@ namespace ts {
/* @internal */ isReferenced?: SymbolFlags; // True if the symbol is referenced elsewhere. Keeps track of the meaning of a reference in case a symbol is both a type parameter and parameter.
/* @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol?
/* @internal */ isAssigned?: boolean; // True if the symbol is a parameter with assignments
/* @internal */ assignmentDeclarationMembers?: Map<number, Declaration>; // detected late-bound assignment declarations associated with the symbol
/* @internal */ assignmentDeclarationMembers?: ESMap<number, Declaration>; // detected late-bound assignment declarations associated with the symbol
}
/* @internal */
@ -4604,8 +4604,8 @@ namespace ts {
declaredType?: Type; // Type of class, interface, enum, type alias, or type parameter
typeParameters?: TypeParameter[]; // Type parameters of type alias (undefined if non-generic)
outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type
instantiations?: Map<string, Type>; // Instantiations of generic type alias (undefined if non-generic)
inferredClassSymbol?: Map<string, TransientSymbol>; // Symbol of an inferred ES5 constructor function
instantiations?: ESMap<string, Type>; // Instantiations of generic type alias (undefined if non-generic)
inferredClassSymbol?: ESMap<string, TransientSymbol>; // Symbol of an inferred ES5 constructor function
mapper?: TypeMapper; // Type mapper for instantiation alias
referenced?: boolean; // True if alias symbol has been referenced as a value that can be emitted
constEnumReferenced?: boolean; // True if alias symbol resolves to a const enum and is referenced as a value ('referenced' will be false)
@ -4624,9 +4624,9 @@ namespace ts {
enumKind?: EnumKind; // Enum declaration classification
originatingImport?: ImportDeclaration | ImportCall; // Import declaration which produced the symbol, present if the symbol is marked as uncallable but had call signatures in `resolveESModuleSymbol`
lateSymbol?: Symbol; // Late-bound symbol for a computed property
specifierCache?: Map<string, string>; // For symbols corresponding to external modules, a cache of incoming path -> module specifier name mappings
specifierCache?: ESMap<string, string>; // For symbols corresponding to external modules, a cache of incoming path -> module specifier name mappings
extendedContainers?: Symbol[]; // Containers (other than the parent) which this symbol is aliased in
extendedContainersByFile?: Map<string, Symbol[]>; // Containers (other than the parent) which this symbol is aliased in
extendedContainersByFile?: ESMap<string, Symbol[]>; // Containers (other than the parent) which this symbol is aliased in
variances?: VarianceFlags[]; // Alias symbol type argument variance cache
deferralConstituents?: Type[]; // Calculated list of constituents for a deferred type
deferralParent?: Type; // Source union/intersection of a deferred type
@ -4718,11 +4718,11 @@ namespace ts {
export type __String = (string & { __escapedIdentifier: void }) | (void & { __escapedIdentifier: void }) | InternalSymbolName;
/** ReadonlyMap where keys are `__String`s. */
export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyMap<__String, T> {
export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyESMap<__String, T> {
}
/** Map where keys are `__String`s. */
export interface UnderscoreEscapedMap<T> extends Map<__String, T>, ReadonlyUnderscoreEscapedMap<T> {
export interface UnderscoreEscapedMap<T> extends ESMap<__String, T>, ReadonlyUnderscoreEscapedMap<T> {
}
/** SymbolTable based on ES6 Map interface. */
@ -4782,10 +4782,10 @@ namespace ts {
switchTypes?: Type[]; // Cached array of switch case expression types
jsxNamespace?: Symbol | false; // Resolved jsx namespace symbol for this node
contextFreeType?: Type; // Cached context-free type used by the first pass of inference; used when a function's return is partially contextually sensitive
deferredNodes?: Map<string, Node>; // Set of nodes whose checking has been deferred
deferredNodes?: ESMap<string, Node>; // Set of nodes whose checking has been deferred
capturedBlockScopeBindings?: Symbol[]; // Block-scoped bindings captured beneath this part of an IterationStatement
outerTypeParameters?: TypeParameter[]; // Outer type parameters of anonymous object type
instantiations?: Map<string, Type>; // Instantiations of generic type alias (undefined if non-generic)
instantiations?: ESMap<string, Type>; // Instantiations of generic type alias (undefined if non-generic)
isExhaustive?: boolean; // Is node an exhaustive switch statement
skipDirectInference?: true; // Flag set by the API `getContextualType` call on a node when `Completions` is passed to force the checker to skip making inferences to a node's type
declarationRequiresScopeChange?: boolean; // Set by `useOuterVariableScopeInParameter` in checker when downlevel emit would change the name resolution scope inside of a parameter.
@ -5084,7 +5084,7 @@ namespace ts {
// Generic class and interface types
export interface GenericType extends InterfaceType, TypeReference {
/* @internal */
instantiations: Map<string, TypeReference>; // Generic instantiation cache
instantiations: ESMap<string, TypeReference>; // Generic instantiation cache
/* @internal */
variances?: VarianceFlags[]; // Variance of each type parameter
}
@ -5272,7 +5272,7 @@ namespace ts {
isDistributive: boolean;
inferTypeParameters?: TypeParameter[];
outerTypeParameters?: TypeParameter[];
instantiations?: Map<string, Type>;
instantiations?: Map<Type>;
aliasSymbol?: Symbol;
aliasTypeArguments?: Type[];
}
@ -5367,7 +5367,7 @@ namespace ts {
/* @internal */
isolatedSignatureType?: ObjectType; // A manufactured type that just contains the signature for purposes of signature comparison
/* @internal */
instantiations?: Map<string, Signature>; // Generic signature instantiation cache
instantiations?: ESMap<string, Signature>; // Generic signature instantiation cache
}
export const enum IndexKind {
@ -5888,7 +5888,7 @@ namespace ts {
/* @internal */
export interface CommandLineOptionBase {
name: string;
type: "string" | "number" | "boolean" | "object" | "list" | Map<string, number | string>; // a value of a primitive type, or an object literal mapping named values to actual values
type: "string" | "number" | "boolean" | "object" | "list" | ESMap<string, number | string>; // a value of a primitive type, or an object literal mapping named values to actual values
isFilePath?: boolean; // True if option value is a path or fileName
shortName?: string; // A short mnemonic for convenience - for instance, 'h' can be used in place of 'help'
description?: DiagnosticMessage; // The message describing what the command line switch does
@ -5913,7 +5913,7 @@ namespace ts {
/* @internal */
export interface CommandLineOptionOfCustomType extends CommandLineOptionBase {
type: Map<string, number | string>; // an object literal mapping named values to actual values
type: ESMap<string, number | string>; // an object literal mapping named values to actual values
}
/* @internal */
@ -5926,7 +5926,7 @@ namespace ts {
/* @internal */
export interface TsConfigOnlyOption extends CommandLineOptionBase {
type: "object";
elementOptions?: Map<string, CommandLineOption>;
elementOptions?: ESMap<string, CommandLineOption>;
extraKeyDiagnostics?: DidYouMeanOptionsDiagnostics;
}
@ -6215,7 +6215,7 @@ namespace ts {
// TODO: later handle this in better way in builder host instead once the api for tsbuild finalizes and doesn't use compilerHost as base
/*@internal*/createDirectory?(directory: string): void;
/*@internal*/getSymlinks?(): ReadonlyMap<string, string>;
/*@internal*/getSymlinks?(): ReadonlyESMap<string, string>;
}
/** true if --out otherwise source file name */
@ -7728,7 +7728,7 @@ namespace ts {
fileExists(path: string): boolean;
getCurrentDirectory(): string;
readFile?(path: string): string | undefined;
getProbableSymlinks?(files: readonly SourceFile[]): ReadonlyMap<string, string>;
getProbableSymlinks?(files: readonly SourceFile[]): ReadonlyESMap<string, string>;
getGlobalTypingsCacheLocation?(): string | undefined;
getSourceFiles(): readonly SourceFile[];
@ -7992,7 +7992,7 @@ namespace ts {
export type PragmaPseudoMapEntry = {[K in keyof PragmaPseudoMap]: {name: K, args: PragmaPseudoMap[K]}}[keyof PragmaPseudoMap];
/* @internal */
export interface ReadonlyPragmaMap extends ReadonlyMap<string, PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]> {
export interface ReadonlyPragmaMap extends ReadonlyESMap<string, PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]> {
get<TKey extends keyof PragmaPseudoMap>(key: TKey): PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][];
forEach(action: <TKey extends keyof PragmaPseudoMap>(value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][], key: TKey) => void): void;
}
@ -8003,7 +8003,7 @@ namespace ts {
* in multiple places
*/
/* @internal */
export interface PragmaMap extends Map<string, PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]>, ReadonlyPragmaMap {
export interface PragmaMap extends ESMap<string, PragmaPseudoMap[keyof PragmaPseudoMap] | PragmaPseudoMap[keyof PragmaPseudoMap][]>, ReadonlyPragmaMap {
set<TKey extends keyof PragmaPseudoMap>(key: TKey, value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][]): this;
get<TKey extends keyof PragmaPseudoMap>(key: TKey): PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][];
forEach(action: <TKey extends keyof PragmaPseudoMap>(value: PragmaPseudoMap[TKey] | PragmaPseudoMap[TKey][], key: TKey) => void): void;

View File

@ -1,7 +1,7 @@
/* @internal */
namespace ts {
export const resolvingEmptyArray: never[] = [] as never[];
export const emptyMap = createMap<never, never>() as ReadonlyMap<never, never> & ReadonlyPragmaMap;
export const emptyMap = createMap<never, never>() as ReadonlyESMap<never, never> & ReadonlyPragmaMap;
export const emptyUnderscoreEscapedMap: ReadonlyUnderscoreEscapedMap<never> = emptyMap as ReadonlyUnderscoreEscapedMap<never>;
export const externalHelpersModuleNameText = "tslib";
@ -132,7 +132,7 @@ namespace ts {
* Calls `callback` for each entry in the map, returning the first truthy result.
* Use `map.forEach` instead for normal iteration.
*/
export function forEachEntry<K, V, U>(map: ReadonlyMap<K, V>, callback: (value: V, key: K) => U | undefined): U | undefined {
export function forEachEntry<K, V, U>(map: ReadonlyESMap<K, V>, callback: (value: V, key: K) => U | undefined): U | undefined {
const iterator = map.entries();
for (let iterResult = iterator.next(); !iterResult.done; iterResult = iterator.next()) {
const [key, value] = iterResult.value;
@ -157,7 +157,7 @@ namespace ts {
}
/** Copy entries from `source` to `target`. */
export function copyEntries<K, V>(source: ReadonlyMap<K, V>, target: Map<K, V>): void {
export function copyEntries<K, V>(source: ReadonlyESMap<K, V>, target: ESMap<K, V>): void {
source.forEach((value, key) => {
target.set(key, value);
});
@ -168,17 +168,17 @@ namespace ts {
*
* @param array the array of input elements.
*/
export function arrayToSet(array: readonly string[]): Map<string, true>;
export function arrayToSet<T>(array: readonly T[], makeKey: (value: T) => string | undefined): Map<string, true>;
export function arrayToSet(array: readonly string[]): ESMap<string, true>;
export function arrayToSet<T>(array: readonly T[], makeKey: (value: T) => string | undefined): ESMap<string, true>;
export function arrayToSet<T>(array: readonly T[], makeKey: (value: T) => __String | undefined): UnderscoreEscapedMap<true>;
export function arrayToSet(array: readonly any[], makeKey?: (value: any) => string | __String | undefined): Map<string, true> | UnderscoreEscapedMap<true> {
export function arrayToSet(array: readonly any[], makeKey?: (value: any) => string | __String | undefined): ESMap<string, true> | UnderscoreEscapedMap<true> {
return arrayToMap<any, true>(array, makeKey || (s => s), returnTrue);
}
export function cloneMap(map: SymbolTable): SymbolTable;
export function cloneMap<T>(map: ReadonlyUnderscoreEscapedMap<T>): UnderscoreEscapedMap<T>;
export function cloneMap<K, V>(map: ReadonlyMap<K, V>): Map<K, V>;
export function cloneMap<K, V>(map: ReadonlyMap<K, V>): Map<K, V> {
export function cloneMap<K, V>(map: ReadonlyESMap<K, V>): ESMap<K, V>;
export function cloneMap<K, V>(map: ReadonlyESMap<K, V>): ESMap<K, V> {
const clone = createMap<K, V>();
copyEntries(map, clone);
return clone;
@ -250,7 +250,7 @@ namespace ts {
export function hasChangesInResolutions<T>(
names: readonly string[],
newResolutions: readonly T[],
oldResolutions: ReadonlyMap<string, T> | undefined,
oldResolutions: ReadonlyESMap<string, T> | undefined,
comparer: (oldResolution: T, newResolution: T) => boolean): boolean {
Debug.assert(names.length === newResolutions.length);
@ -5261,7 +5261,7 @@ namespace ts {
/**
* clears already present map by calling onDeleteExistingValue callback before deleting that key/value
*/
export function clearMap<T>(map: { forEach: Map<string, T>["forEach"]; clear: Map<string, T>["clear"]; }, onDeleteValue: (valueInMap: T, key: string) => void) {
export function clearMap<T>(map: { forEach: ESMap<string, T>["forEach"]; clear: ESMap<string, T>["clear"]; }, onDeleteValue: (valueInMap: T, key: string) => void) {
// Remove all
map.forEach(onDeleteValue);
map.clear();
@ -5283,8 +5283,8 @@ namespace ts {
* Mutates the map with newMap such that keys in map will be same as newMap.
*/
export function mutateMapSkippingNewValues<T, U>(
map: Map<string, T>,
newMap: ReadonlyMap<string, U>,
map: ESMap<string, T>,
newMap: ReadonlyESMap<string, U>,
options: MutateMapSkippingNewValuesOptions<T, U>
) {
const { onDeleteValue, onExistingValue } = options;
@ -5310,7 +5310,7 @@ namespace ts {
/**
* Mutates the map with newMap such that keys in map will be same as newMap.
*/
export function mutateMap<T, U>(map: Map<string, T>, newMap: ReadonlyMap<string, U>, options: MutateMapOptions<T, U>) {
export function mutateMap<T, U>(map: ESMap<string, T>, newMap: ReadonlyESMap<string, U>, options: MutateMapOptions<T, U>) {
// Needs update
mutateMapSkippingNewValues(map, newMap, options);
@ -5380,9 +5380,9 @@ namespace ts {
}
/** Add a value to a set, and return true if it wasn't already present. */
export function addToSeen(seen: Map<string, true>, key: string | number): boolean;
export function addToSeen<T>(seen: Map<string, T>, key: string | number, value: T): boolean;
export function addToSeen<T>(seen: Map<string, T>, key: string | number, value: T = true as any): boolean {
export function addToSeen(seen: ESMap<string, true>, key: string | number): boolean;
export function addToSeen<T>(seen: ESMap<string, T>, key: string | number, value: T): boolean;
export function addToSeen<T>(seen: ESMap<string, T>, key: string | number, value: T = true as any): boolean {
key = String(key);
if (seen.has(key)) {
return false;
@ -5937,7 +5937,7 @@ namespace ts {
return true;
}
export function discoverProbableSymlinks(files: readonly SourceFile[], getCanonicalFileName: GetCanonicalFileName, cwd: string): ReadonlyMap<string, string> {
export function discoverProbableSymlinks(files: readonly SourceFile[], getCanonicalFileName: GetCanonicalFileName, cwd: string): ReadonlyESMap<string, string> {
const result = createMap<string>();
const symlinks = flatten<readonly [string, string]>(mapDefined(files, sf =>
sf.resolvedModules && compact(arrayFrom(mapIterator(sf.resolvedModules.values(), res =>
@ -6648,7 +6648,7 @@ namespace ts {
return a === b || typeof a === "object" && a !== null && typeof b === "object" && b !== null && equalOwnProperties(a as MapLike<unknown>, b as MapLike<unknown>, isJsonEqual);
}
export function getOrUpdate<T>(map: Map<string, T>, key: string, getDefault: () => T): T {
export function getOrUpdate<T>(map: ESMap<string, T>, key: string, getDefault: () => T): T {
const got = map.get(key);
if (got === undefined) {
const value = getDefault();

View File

@ -246,8 +246,8 @@ namespace ts {
let builderProgram: T;
let reloadLevel: ConfigFileProgramReloadLevel; // level to indicate if the program needs to be reloaded from config file/just filenames etc
let missingFilesMap: Map<Path, FileWatcher>; // Map of file watchers for the missing files
let watchedWildcardDirectories: Map<string, WildcardDirectoryWatcher>; // map of watchers for the wild card directories in the config file
let missingFilesMap: ESMap<Path, FileWatcher>; // Map of file watchers for the missing files
let watchedWildcardDirectories: ESMap<string, WildcardDirectoryWatcher>; // map of watchers for the wild card directories in the config file
let timerToUpdateProgram: any; // timer callback to recompile the program
let timerToInvalidateFailedLookupResolutions: any; // timer callback to invalidate resolutions for changes in failed lookup locations

View File

@ -262,7 +262,7 @@ namespace ts {
*/
export function updateMissingFilePathsWatch(
program: Program,
missingFileWatches: Map<Path, FileWatcher>,
missingFileWatches: ESMap<Path, FileWatcher>,
createMissingFileWatch: (missingFilePath: Path) => FileWatcher,
) {
const missingFilePaths = program.getMissingFilePaths();
@ -293,8 +293,8 @@ namespace ts {
* as wildcard directories wont change unless reloading config file
*/
export function updateWatchingWildcardDirectories(
existingWatchedForWildcards: Map<string, WildcardDirectoryWatcher>,
wildcardDirectories: Map<string, WatchDirectoryFlags>,
existingWatchedForWildcards: ESMap<string, WildcardDirectoryWatcher>,
wildcardDirectories: ESMap<string, WatchDirectoryFlags>,
watchDirectory: (directory: string, flags: WatchDirectoryFlags) => FileWatcher
) {
mutateMap(

View File

@ -100,7 +100,7 @@ namespace ts {
if (option.name === "lib") {
description = getDiagnosticText(option.description);
const element = (<CommandLineOptionOfListType>option).element;
const typeMap = <Map<string, number | string>>element.type;
const typeMap = <ESMap<string, number | string>>element.type;
optionsDescriptionMap.set(description, arrayFrom(typeMap.keys()).map(key => `'${key}'`));
}
else {

View File

@ -35,7 +35,7 @@ namespace ts.server {
export class SessionClient implements LanguageService {
private sequence = 0;
private lineMaps: Map<string, number[]> = createMap<number[]>();
private lineMaps: ESMap<string, number[]> = createMap<number[]>();
private messages: string[] = [];
private lastRenameEntry: RenameEntry | undefined;

View File

@ -29,7 +29,7 @@ namespace FourSlash {
symlinks: vfs.FileSet | undefined;
// A mapping from marker names to name/position pairs
markerPositions: ts.Map<string, Marker>;
markerPositions: ts.ESMap<string, Marker>;
markers: Marker[];
@ -2341,7 +2341,7 @@ namespace FourSlash {
return this.getRanges().filter(r => r.fileName === fileName);
}
public rangesByText(): ts.Map<string, Range[]> {
public rangesByText(): ts.ESMap<string, Range[]> {
if (this.testData.rangesByText) return this.testData.rangesByText;
const result = ts.createMultiMap<Range>();
this.testData.rangesByText = result;
@ -3421,7 +3421,7 @@ namespace FourSlash {
return text;
}
private formatCallHierarchyItem(file: FourSlashFile, callHierarchyItem: ts.CallHierarchyItem, direction: CallHierarchyItemDirection, seen: ts.Map<string, boolean>, prefix: string, trailingPrefix: string = prefix) {
private formatCallHierarchyItem(file: FourSlashFile, callHierarchyItem: ts.CallHierarchyItem, direction: CallHierarchyItemDirection, seen: ts.ESMap<string, boolean>, prefix: string, trailingPrefix: string = prefix) {
const key = `${callHierarchyItem.file}|${JSON.stringify(callHierarchyItem.span)}|${direction}`;
const alreadySeen = seen.has(key);
seen.set(key, true);
@ -3945,7 +3945,7 @@ namespace FourSlash {
throw new Error(errorMessage);
}
function recordObjectMarker(fileName: string, location: LocationInformation, text: string, markerMap: ts.Map<string, Marker>, markers: Marker[]): Marker | undefined {
function recordObjectMarker(fileName: string, location: LocationInformation, text: string, markerMap: ts.ESMap<string, Marker>, markers: Marker[]): Marker | undefined {
let markerValue: any;
try {
// Attempt to parse the marker value as JSON
@ -3976,7 +3976,7 @@ namespace FourSlash {
return marker;
}
function recordMarker(fileName: string, location: LocationInformation, name: string, markerMap: ts.Map<string, Marker>, markers: Marker[]): Marker | undefined {
function recordMarker(fileName: string, location: LocationInformation, name: string, markerMap: ts.ESMap<string, Marker>, markers: Marker[]): Marker | undefined {
const marker: Marker = {
fileName,
position: location.position
@ -3995,7 +3995,7 @@ namespace FourSlash {
}
}
function parseFileContent(content: string, fileName: string, markerMap: ts.Map<string, Marker>, markers: Marker[], ranges: Range[]): FourSlashFile {
function parseFileContent(content: string, fileName: string, markerMap: ts.ESMap<string, Marker>, markers: Marker[], ranges: Range[]): FourSlashFile {
content = chompLeadingSpace(content);
// Any slash-star comment with a character not in this string is not a marker.

View File

@ -27,7 +27,7 @@ namespace FourSlashInterface {
return this.ranges().map(r => ts.createTextSpan(r.pos, r.end - r.pos));
}
public rangesByText(): ts.Map<string, FourSlash.Range[]> {
public rangesByText(): ts.ESMap<string, FourSlash.Range[]> {
return this.state.rangesByText();
}

View File

@ -243,7 +243,7 @@ namespace Harness {
export const es2015DefaultLibFileName = "lib.es2015.d.ts";
// Cache of lib files from "built/local"
let libFileNameSourceFileMap: ts.Map<string, ts.SourceFile> | undefined;
let libFileNameSourceFileMap: ts.ESMap<string, ts.SourceFile> | undefined;
export function getDefaultLibrarySourceFile(fileName = defaultLibFileName): ts.SourceFile | undefined {
if (!isDefaultLibraryFile(fileName)) {
@ -313,7 +313,7 @@ namespace Harness {
{ name: "fullEmitPaths", type: "boolean" }
];
let optionsIndex: ts.Map<string, ts.CommandLineOption>;
let optionsIndex: ts.ESMap<string, ts.CommandLineOption>;
function getCommandLineOption(name: string): ts.CommandLineOption | undefined {
if (!optionsIndex) {
optionsIndex = ts.createMap<ts.CommandLineOption>();
@ -958,7 +958,7 @@ namespace Harness {
}
}
function checkDuplicatedFileName(resultName: string, dupeCase: ts.Map<string, number>): string {
function checkDuplicatedFileName(resultName: string, dupeCase: ts.ESMap<string, number>): string {
resultName = sanitizeTestFilePath(resultName);
if (dupeCase.has(resultName)) {
// A different baseline filename should be manufactured if the names differ only in case, for windows compat
@ -1066,9 +1066,9 @@ namespace Harness {
}
}
let booleanVaryByStarSettingValues: ts.Map<string, string | number> | undefined;
let booleanVaryByStarSettingValues: ts.ESMap<string, string | number> | undefined;
function getVaryByStarSettingValues(varyBy: string): ts.ReadonlyMap<string, string | number> | undefined {
function getVaryByStarSettingValues(varyBy: string): ts.ReadonlyESMap<string, string | number> | undefined {
const option = ts.forEach(ts.optionDeclarations, decl => ts.equateStringsCaseInsensitive(decl.name, varyBy) ? decl : undefined);
if (option) {
if (typeof option.type === "object") {

View File

@ -126,7 +126,7 @@ namespace Harness.LanguageService {
export abstract class LanguageServiceAdapterHost {
public readonly sys = new fakes.System(new vfs.FileSystem(/*ignoreCase*/ true, { cwd: virtualFileSystemRoot }));
public typesRegistry: ts.Map<string, void> | undefined;
public typesRegistry: ts.ESMap<string, void> | undefined;
private scriptInfos: collections.SortedMap<string, ScriptInfo>;
constructor(protected cancellationToken = DefaultHostCancellationToken.instance,

View File

@ -83,7 +83,7 @@ namespace Playback {
let recordLog: IoLog | undefined;
let replayLog: IoLog | undefined;
let replayFilesRead: ts.Map<string, IoLogFile> | undefined;
let replayFilesRead: ts.ESMap<string, IoLogFile> | undefined;
let recordLogFileNameBase = "";
interface Memoized<T> {

View File

@ -36,7 +36,7 @@ interface Array<T> { length: number; [n: number]: T; }`
currentDirectory?: string;
newLine?: string;
windowsStyleRoot?: string;
environmentVariables?: Map<string, string>;
environmentVariables?: ESMap<string, string>;
runWithoutRecursiveWatches?: boolean;
runWithFallbackPolling?: boolean;
}
@ -127,7 +127,7 @@ interface Array<T> { length: number; [n: number]: T; }`
return { close: () => map.remove(path, callback) };
}
function getDiffInKeys<T>(map: Map<string, T>, expectedKeys: readonly string[]) {
function getDiffInKeys<T>(map: ESMap<string, T>, expectedKeys: readonly string[]) {
if (map.size === expectedKeys.length) {
return "";
}
@ -154,19 +154,19 @@ interface Array<T> { length: number; [n: number]: T; }`
return `\n\nNotInActual: ${notInActual}\nDuplicates: ${duplicates}\nInActualButNotInExpected: ${inActualNotExpected}`;
}
export function verifyMapSize(caption: string, map: Map<string, any>, expectedKeys: readonly string[]) {
export function verifyMapSize(caption: string, map: ESMap<string, any>, expectedKeys: readonly string[]) {
assert.equal(map.size, expectedKeys.length, `${caption}: incorrect size of map: Actual keys: ${arrayFrom(map.keys())} Expected: ${expectedKeys}${getDiffInKeys(map, expectedKeys)}`);
}
export type MapValueTester<T, U> = [Map<string, U[]> | undefined, (value: T) => U];
export type MapValueTester<T, U> = [ESMap<string, U[]> | undefined, (value: T) => U];
export function checkMap<T, U = undefined>(caption: string, actual: MultiMap<string, T>, expectedKeys: ReadonlyMap<string, number>, valueTester?: MapValueTester<T,U>): void;
export function checkMap<T, U = undefined>(caption: string, actual: MultiMap<string, T>, expectedKeys: ReadonlyESMap<string, number>, valueTester?: MapValueTester<T,U>): void;
export function checkMap<T, U = undefined>(caption: string, actual: MultiMap<string, T>, expectedKeys: readonly string[], eachKeyCount: number, valueTester?: MapValueTester<T, U>): void;
export function checkMap<T>(caption: string, actual: Map<string, T> | MultiMap<string, T>, expectedKeys: readonly string[], eachKeyCount: undefined): void;
export function checkMap<T>(caption: string, actual: ESMap<string, T> | MultiMap<string, T>, expectedKeys: readonly string[], eachKeyCount: undefined): void;
export function checkMap<T, U = undefined>(
caption: string,
actual: Map<string, T> | MultiMap<string, T>,
expectedKeysMapOrArray: ReadonlyMap<string, number> | readonly string[],
actual: ESMap<string, T> | MultiMap<string, T>,
expectedKeysMapOrArray: ReadonlyESMap<string, number> | readonly string[],
eachKeyCountOrValueTester?: number | MapValueTester<T, U>,
valueTester?: MapValueTester<T, U>) {
const expectedKeys = isArray(expectedKeysMapOrArray) ? arrayToMap(expectedKeysMapOrArray, s => s, () => eachKeyCountOrValueTester as number) : expectedKeysMapOrArray;
@ -203,9 +203,9 @@ interface Array<T> { length: number; [n: number]: T; }`
fileName: string;
pollingInterval: PollingInterval;
}
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: ReadonlyMap<string, number>, expectedDetails?: Map<string, WatchFileDetails[]>): void;
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: readonly string[], eachFileWatchCount: number, expectedDetails?: Map<string, WatchFileDetails[]>): void;
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: ReadonlyMap<string, number> | readonly string[], eachFileWatchCountOrExpectedDetails?: number | Map<string, WatchFileDetails[]>, expectedDetails?: Map<string, WatchFileDetails[]>) {
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: ReadonlyESMap<string, number>, expectedDetails?: ESMap<string, WatchFileDetails[]>): void;
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: readonly string[], eachFileWatchCount: number, expectedDetails?: ESMap<string, WatchFileDetails[]>): void;
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: ReadonlyESMap<string, number> | readonly string[], eachFileWatchCountOrExpectedDetails?: number | ESMap<string, WatchFileDetails[]>, expectedDetails?: ESMap<string, WatchFileDetails[]>) {
if (!isNumber(eachFileWatchCountOrExpectedDetails)) expectedDetails = eachFileWatchCountOrExpectedDetails;
if (isArray(expectedFiles)) {
checkMap(
@ -235,9 +235,9 @@ interface Array<T> { length: number; [n: number]: T; }`
fallbackPollingInterval: PollingInterval;
fallbackOptions: WatchOptions | undefined;
}
export function checkWatchedDirectoriesDetailed(host: TestServerHost, expectedDirectories: ReadonlyMap<string, number>, recursive: boolean, expectedDetails?: Map<string, WatchDirectoryDetails[]>): void;
export function checkWatchedDirectoriesDetailed(host: TestServerHost, expectedDirectories: readonly string[], eachDirectoryWatchCount: number, recursive: boolean, expectedDetails?: Map<string, WatchDirectoryDetails[]>): void;
export function checkWatchedDirectoriesDetailed(host: TestServerHost, expectedDirectories: ReadonlyMap<string, number> | readonly string[], recursiveOrEachDirectoryWatchCount: boolean | number, recursiveOrExpectedDetails?: boolean | Map<string, WatchDirectoryDetails[]>, expectedDetails?: Map<string, WatchDirectoryDetails[]>) {
export function checkWatchedDirectoriesDetailed(host: TestServerHost, expectedDirectories: ReadonlyESMap<string, number>, recursive: boolean, expectedDetails?: ESMap<string, WatchDirectoryDetails[]>): void;
export function checkWatchedDirectoriesDetailed(host: TestServerHost, expectedDirectories: readonly string[], eachDirectoryWatchCount: number, recursive: boolean, expectedDetails?: ESMap<string, WatchDirectoryDetails[]>): void;
export function checkWatchedDirectoriesDetailed(host: TestServerHost, expectedDirectories: ReadonlyESMap<string, number> | readonly string[], recursiveOrEachDirectoryWatchCount: boolean | number, recursiveOrExpectedDetails?: boolean | ESMap<string, WatchDirectoryDetails[]>, expectedDetails?: ESMap<string, WatchDirectoryDetails[]>) {
if (typeof recursiveOrExpectedDetails !== "boolean") expectedDetails = recursiveOrExpectedDetails;
if (isArray(expectedDirectories)) {
checkMap(
@ -368,7 +368,7 @@ interface Array<T> { length: number; [n: number]: T; }`
fileOrFolderorSymLinkList: readonly FileOrFolderOrSymLink[];
newLine?: string;
useWindowsStylePaths?: boolean;
environmentVariables?: Map<string, string>;
environmentVariables?: ESMap<string, string>;
}
export class TestServerHost implements server.ServerHost, FormatDiagnosticsHost, ModuleResolutionHost {
@ -376,7 +376,7 @@ interface Array<T> { length: number; [n: number]: T; }`
private readonly output: string[] = [];
private fs: Map<Path, FSEntry> = new Map();
private fs: ESMap<Path, FSEntry> = new Map();
private time = timeIncrements;
getCanonicalFileName: (s: string) => string;
private toPath: (f: string) => Path;
@ -391,7 +391,7 @@ interface Array<T> { length: number; [n: number]: T; }`
public readonly useCaseSensitiveFileNames: boolean;
public readonly newLine: string;
public readonly windowsStyleRoot?: string;
private readonly environmentVariables?: Map<string, string>;
private readonly environmentVariables?: ESMap<string, string>;
private readonly executingFilePath: string;
private readonly currentDirectory: string;
public require: ((initialPath: string, moduleName: string) => RequireResult) | undefined;
@ -1042,7 +1042,7 @@ interface Array<T> { length: number; [n: number]: T; }`
this.clearOutput();
}
snap(): Map<Path, FSEntry> {
snap(): ESMap<Path, FSEntry> {
const result = new Map<Path, FSEntry>();
this.fs.forEach((value, key) => {
const cloneValue = clone(value);
@ -1055,8 +1055,8 @@ interface Array<T> { length: number; [n: number]: T; }`
return result;
}
writtenFiles?: Map<Path, number>;
diff(baseline: string[], base: Map<string, FSEntry> = new Map()) {
writtenFiles?: ESMap<Path, number>;
diff(baseline: string[], base: ESMap<string, FSEntry> = new Map()) {
this.fs.forEach(newFsEntry => {
diffFsEntry(baseline, base.get(newFsEntry.path), newFsEntry, this.writtenFiles);
});
@ -1115,7 +1115,7 @@ interface Array<T> { length: number; [n: number]: T; }`
function diffFsSymLink(baseline: string[], fsEntry: FsSymLink) {
baseline.push(`//// [${fsEntry.fullPath}] symlink(${fsEntry.symLink})`);
}
function diffFsEntry(baseline: string[], oldFsEntry: FSEntry | undefined, newFsEntry: FSEntry | undefined, writtenFiles: Map<string, any> | undefined): void {
function diffFsEntry(baseline: string[], oldFsEntry: FSEntry | undefined, newFsEntry: FSEntry | undefined, writtenFiles: ESMap<string, any> | undefined): void {
const file = newFsEntry && newFsEntry.fullPath;
if (isFsFile(oldFsEntry)) {
if (isFsFile(newFsEntry)) {
@ -1208,7 +1208,7 @@ interface Array<T> { length: number; [n: number]: T; }`
}
}
export type TestServerHostTrackingWrittenFiles = TestServerHost & { writtenFiles: Map<Path, number>; };
export type TestServerHostTrackingWrittenFiles = TestServerHost & { writtenFiles: ESMap<Path, number>; };
export function changeToHostTrackingWrittenFiles(inputHost: TestServerHost) {
const host = inputHost as TestServerHostTrackingWrittenFiles;

View File

@ -77,7 +77,7 @@ namespace ts.JsTyping {
/**
* A map of loose file names to library names that we are confident require typings
*/
export type SafeList = ReadonlyMap<string, string>;
export type SafeList = ReadonlyESMap<string, string>;
export function loadSafeList(host: TypingResolutionHost, safeListPath: Path): SafeList {
const result = readConfigFile(safeListPath, path => host.readFile(path));
@ -107,10 +107,10 @@ namespace ts.JsTyping {
fileNames: string[],
projectRootPath: Path,
safeList: SafeList,
packageNameToTypingLocation: ReadonlyMap<string, CachedTyping>,
packageNameToTypingLocation: ReadonlyESMap<string, CachedTyping>,
typeAcquisition: TypeAcquisition,
unresolvedImports: readonly string[],
typesRegistry: ReadonlyMap<string, MapLike<string>>):
typesRegistry: ReadonlyESMap<string, MapLike<string>>):
{ cachedTypingPaths: string[], newTypingNames: string[], filesToWatch: string[] } {
if (!typeAcquisition || !typeAcquisition.enable) {

View File

@ -157,11 +157,11 @@ namespace ts.server {
[name: string]: { match: RegExp, exclude?: (string | number)[][], types?: string[] };
}
function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions: CommandLineOption[]): Map<string, Map<string, number>> {
const map: Map<string, Map<string, number>> = createMap<Map<string, number>>();
function prepareConvertersForEnumLikeCompilerOptions(commandLineOptions: CommandLineOption[]): ESMap<string, ESMap<string, number>> {
const map: ESMap<string, ESMap<string, number>> = createMap<ESMap<string, number>>();
for (const option of commandLineOptions) {
if (typeof option.type === "object") {
const optionMap = <Map<string, number>>option.type;
const optionMap = <ESMap<string, number>>option.type;
// verify that map contains only numbers
optionMap.forEach(value => {
Debug.assert(typeof value === "number");
@ -373,7 +373,7 @@ namespace ts.server {
* It is false when the open file that would still be impacted by existence of
* this config file but it is not the root of inferred project
*/
openFilesImpactedByConfigFile: Map<Path, boolean>;
openFilesImpactedByConfigFile: ESMap<Path, boolean>;
/**
* The file watcher watching the config file because there is open script info that is root of
* inferred project and will be impacted by change in the status of the config file
@ -590,7 +590,7 @@ namespace ts.server {
/**
* maps external project file name to list of config files that were the part of this project
*/
private readonly externalProjectToConfiguredProjectMap: Map<string, NormalizedPath[]> = createMap<NormalizedPath[]>();
private readonly externalProjectToConfiguredProjectMap: ESMap<string, NormalizedPath[]> = createMap<NormalizedPath[]>();
/**
* external projects (configuration and list of root files is not controlled by tsserver)
@ -603,11 +603,11 @@ namespace ts.server {
/**
* projects specified by a tsconfig.json file
*/
readonly configuredProjects = createMap<ConfiguredProject>();
readonly configuredProjects: Map<ConfiguredProject> = createMap<ConfiguredProject>();
/**
* Open files: with value being project root path, and key being Path of the file that is open
*/
readonly openFiles = new Map<Path, NormalizedPath | undefined>();
readonly openFiles: Map<NormalizedPath | undefined> = new Map<Path, NormalizedPath | undefined>();
/**
* Map of open files that are opened without complete path but have projectRoot as current directory
*/
@ -620,7 +620,7 @@ namespace ts.server {
/**
* Project size for configured or external projects
*/
private readonly projectToSizeMap: Map<string, number> = createMap<number>();
private readonly projectToSizeMap: ESMap<string, number> = createMap<number>();
/**
* This is a map of config file paths existence that doesnt need query to disk
* - The entry can be present because there is inferred project that needs to watch addition of config file to directory
@ -656,7 +656,7 @@ namespace ts.server {
public readonly globalPlugins: readonly string[];
public readonly pluginProbeLocations: readonly string[];
public readonly allowLocalPluginLoads: boolean;
private currentPluginConfigOverrides: Map<string, any> | undefined;
private currentPluginConfigOverrides: ESMap<string, any> | undefined;
public readonly typesMapLocation: string | undefined;
@ -671,7 +671,7 @@ namespace ts.server {
/*@internal*/
readonly packageJsonCache: PackageJsonCache;
/*@internal*/
private packageJsonFilesMap: Map<Path, FileWatcher> | undefined;
private packageJsonFilesMap: ESMap<Path, FileWatcher> | undefined;
private performanceEventHandler?: PerformanceEventHandler;
@ -875,7 +875,7 @@ namespace ts.server {
const event: ProjectsUpdatedInBackgroundEvent = {
eventName: ProjectsUpdatedInBackgroundEvent,
data: {
openFiles: arrayFrom(this.openFiles.keys(), path => this.getScriptInfoForPath(path)!.fileName)
openFiles: arrayFrom(this.openFiles.keys(), path => this.getScriptInfoForPath(path as Path)!.fileName)
}
};
this.eventHandler(event);
@ -1375,7 +1375,7 @@ namespace ts.server {
private assignOrphanScriptInfosToInferredProject() {
// collect orphaned files and assign them to inferred project just like we treat open of a file
this.openFiles.forEach((projectRootPath, path) => {
const info = this.getScriptInfoForPath(path)!;
const info = this.getScriptInfoForPath(path as Path)!;
// collect all orphaned script infos from open files
if (info.isOrphan()) {
this.assignOrphanScriptInfoToInferredProject(info, projectRootPath);
@ -1798,7 +1798,7 @@ namespace ts.server {
this.logger.info("Open files: ");
this.openFiles.forEach((projectRootPath, path) => {
const info = this.getScriptInfoForPath(path)!;
const info = this.getScriptInfoForPath(path as Path)!;
this.logger.info(`\tFileName: ${info.fileName} ProjectRootPath: ${projectRootPath}`);
this.logger.info(`\t\tProjects: ${info.containingProjects.map(p => p.getProjectName())}`);
});
@ -2747,7 +2747,7 @@ namespace ts.server {
// as there is no need to load contents of the files from the disk
// Reload Projects
this.reloadConfiguredProjectForFiles(this.openFiles, /*delayReload*/ false, returnTrue, "User requested reload projects");
this.reloadConfiguredProjectForFiles(this.openFiles as ESMap<Path, NormalizedPath | undefined>, /*delayReload*/ false, returnTrue, "User requested reload projects");
this.ensureProjectForOpenFiles();
}
@ -2771,7 +2771,7 @@ namespace ts.server {
* If the there is no existing project it just opens the configured project for the config file
* reloadForInfo provides a way to filter out files to reload configured project for
*/
private reloadConfiguredProjectForFiles<T>(openFiles: Map<Path, T>, delayReload: boolean, shouldReloadProjectFor: (openFileValue: T) => boolean, reason: string) {
private reloadConfiguredProjectForFiles<T>(openFiles: ESMap<Path, T>, delayReload: boolean, shouldReloadProjectFor: (openFileValue: T) => boolean, reason: string) {
const updatedProjects = createMap<true>();
// try to reload config file for all open files
openFiles.forEach((openFileValue, path) => {
@ -2860,7 +2860,7 @@ namespace ts.server {
this.printProjects();
this.openFiles.forEach((projectRootPath, path) => {
const info = this.getScriptInfoForPath(path)!;
const info = this.getScriptInfoForPath(path as Path)!;
// collect all orphaned script infos from open files
if (info.isOrphan()) {
this.assignOrphanScriptInfoToInferredProject(info, projectRootPath);

View File

@ -114,7 +114,7 @@ namespace ts.server {
generatedFilePath: Path;
watcher: FileWatcher;
}
type GeneratedFileWatcherMap = GeneratedFileWatcher | Map<Path, GeneratedFileWatcher>;
type GeneratedFileWatcherMap = GeneratedFileWatcher | ESMap<Path, GeneratedFileWatcher>;
function isGeneratedFileWatcher(watch: GeneratedFileWatcherMap): watch is GeneratedFileWatcher {
return (watch as GeneratedFileWatcher).generatedFilePath !== undefined;
}
@ -130,7 +130,7 @@ namespace ts.server {
private rootFilesMap = createMap<ProjectRootFile>();
private program: Program | undefined;
private externalFiles: SortedReadonlyArray<string> | undefined;
private missingFilesMap: Map<Path, FileWatcher> | undefined;
private missingFilesMap: ESMap<Path, FileWatcher> | undefined;
private generatedFilesMap: GeneratedFileWatcherMap | undefined;
private plugins: PluginModuleWithName[] = [];
@ -171,7 +171,7 @@ namespace ts.server {
/**
* Set of files that was returned from the last call to getChangesSinceVersion.
*/
private lastReportedFileNames: Map<string, boolean> | undefined;
private lastReportedFileNames: ESMap<string, boolean> | undefined;
/**
* Last version that was reported.
*/
@ -246,7 +246,7 @@ namespace ts.server {
/*@internal*/
private dirtyFilesForSuggestions: Set<Path> | undefined;
/*@internal*/
private symlinks: ReadonlyMap<string, string> | undefined;
private symlinks: ReadonlyESMap<string, string> | undefined;
/*@internal*/
autoImportProviderHost: AutoImportProviderProject | false | undefined;
@ -323,7 +323,7 @@ namespace ts.server {
}
/*@internal*/
getProbableSymlinks(files: readonly SourceFile[]): ReadonlyMap<string, string> {
getProbableSymlinks(files: readonly SourceFile[]): ReadonlyESMap<string, string> {
return this.symlinks || (this.symlinks = discoverProbableSymlinks(
files,
this.getCanonicalFileName,
@ -1110,7 +1110,7 @@ namespace ts.server {
watcher
)) {
closeFileWatcherOf(watcher);
(this.generatedFilesMap as Map<string, GeneratedFileWatcher>).delete(source);
(this.generatedFilesMap as ESMap<string, GeneratedFileWatcher>).delete(source);
}
});
}
@ -1386,11 +1386,11 @@ namespace ts.server {
getChangesSinceVersion(lastKnownVersion?: number, includeProjectReferenceRedirectInfo?: boolean): ProjectFilesWithTSDiagnostics {
const includeProjectReferenceRedirectInfoIfRequested =
includeProjectReferenceRedirectInfo
? (files: Map<string, boolean>) => arrayFrom(files.entries(), ([fileName, isSourceOfProjectReferenceRedirect]): protocol.FileWithProjectReferenceRedirectInfo => ({
? (files: ESMap<string, boolean>) => arrayFrom(files.entries(), ([fileName, isSourceOfProjectReferenceRedirect]): protocol.FileWithProjectReferenceRedirectInfo => ({
fileName,
isSourceOfProjectReferenceRedirect
}))
: (files: Map<string, boolean>) => arrayFrom(files.keys());
: (files: ESMap<string, boolean>) => arrayFrom(files.keys());
// Update the graph only if initial configured project load is not pending
if (!this.isInitialLoadPending()) {
@ -1425,8 +1425,8 @@ namespace ts.server {
info => info.isSourceOfProjectReferenceRedirect
);
const added: Map<string, boolean> = new Map<string, boolean>();
const removed: Map<string, boolean> = new Map<string, boolean>();
const added: ESMap<string, boolean> = new Map<string, boolean>();
const removed: ESMap<string, boolean> = new Map<string, boolean>();
const updated: string[] = updatedFileNames ? arrayFrom(updatedFileNames.keys()) : [];
const updatedRedirects: protocol.FileWithProjectReferenceRedirectInfo[] = [];
@ -1498,7 +1498,7 @@ namespace ts.server {
return !!this.program && this.program.isSourceOfProjectReferenceRedirect(fileName);
}
protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map<string, any> | undefined) {
protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map<any> | undefined) {
const host = this.projectService.host;
if (!host.require) {
@ -1530,7 +1530,7 @@ namespace ts.server {
}
}
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<string, any> | undefined) {
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<any> | undefined) {
this.projectService.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
const log = (message: string) => this.projectService.logger.info(message);
@ -1663,12 +1663,12 @@ namespace ts.server {
}
}
function getUnresolvedImports(program: Program, cachedUnresolvedImportsPerFile: Map<Path, readonly string[]>): SortedReadonlyArray<string> {
function getUnresolvedImports(program: Program, cachedUnresolvedImportsPerFile: ESMap<Path, readonly string[]>): SortedReadonlyArray<string> {
const ambientModules = program.getTypeChecker().getAmbientModules().map(mod => stripQuotes(mod.getName()));
return sortAndDeduplicate(flatMap(program.getSourceFiles(), sourceFile =>
extractUnresolvedImportsFromSourceFile(sourceFile, ambientModules, cachedUnresolvedImportsPerFile)));
}
function extractUnresolvedImportsFromSourceFile(file: SourceFile, ambientModules: readonly string[], cachedUnresolvedImportsPerFile: Map<Path, readonly string[]>): readonly string[] {
function extractUnresolvedImportsFromSourceFile(file: SourceFile, ambientModules: readonly string[], cachedUnresolvedImportsPerFile: ESMap<Path, readonly string[]>): readonly string[] {
return getOrUpdate(cachedUnresolvedImportsPerFile, file.path, () => {
if (!file.resolvedModules) return emptyArray;
let unresolvedImports: string[] | undefined;
@ -1736,7 +1736,7 @@ namespace ts.server {
watchOptions: WatchOptions | undefined,
projectRootPath: NormalizedPath | undefined,
currentDirectory: string | undefined,
pluginConfigOverrides: Map<string, any> | undefined) {
pluginConfigOverrides: ESMap<string, any> | undefined) {
super(InferredProject.newName(),
ProjectKind.Inferred,
projectService,
@ -1950,7 +1950,7 @@ namespace ts.server {
private typeAcquisition!: TypeAcquisition; // TODO: GH#18217
/* @internal */
configFileWatcher: FileWatcher | undefined;
private directoriesWatchedForWildcards: Map<string, WildcardDirectoryWatcher> | undefined;
private directoriesWatchedForWildcards: ESMap<string, WildcardDirectoryWatcher> | undefined;
readonly canonicalConfigFilePath: NormalizedPath;
/* @internal */
@ -2112,7 +2112,7 @@ namespace ts.server {
}
/*@internal*/
enablePluginsWithOptions(options: CompilerOptions, pluginConfigOverrides: Map<string, any> | undefined) {
enablePluginsWithOptions(options: CompilerOptions, pluginConfigOverrides: ESMap<string, any> | undefined) {
const host = this.projectService.host;
if (!host.require) {
@ -2167,7 +2167,7 @@ namespace ts.server {
}
/*@internal*/
watchWildcards(wildcardDirectories: Map<string, WatchDirectoryFlags>) {
watchWildcards(wildcardDirectories: ESMap<string, WatchDirectoryFlags>) {
updateWatchingWildcardDirectories(
this.directoriesWatchedForWildcards || (this.directoriesWatchedForWildcards = createMap()),
wildcardDirectories,
@ -2290,7 +2290,7 @@ namespace ts.server {
lastFileExceededProgramSize: string | undefined,
public compileOnSaveEnabled: boolean,
projectFilePath?: string,
pluginConfigOverrides?: Map<string, any>,
pluginConfigOverrides?: ESMap<string, any>,
watchOptions?: WatchOptions) {
super(externalProjectName,
ProjectKind.External,

View File

@ -41,7 +41,7 @@ namespace ts.server {
if ((arr1 || emptyArray).length === 0 && (arr2 || emptyArray).length === 0) {
return true;
}
const set: Map<string, boolean> = createMap<boolean>();
const set: ESMap<string, boolean> = createMap<boolean>();
let unique = 0;
for (const v of arr1!) {
@ -83,7 +83,7 @@ namespace ts.server {
/*@internal*/
export class TypingsCache {
private readonly perProjectCache: Map<string, TypingsCacheEntry> = createMap<TypingsCacheEntry>();
private readonly perProjectCache: ESMap<string, TypingsCacheEntry> = createMap<TypingsCacheEntry>();
constructor(private readonly installer: ITypingsInstaller) {
}

View File

@ -1,7 +1,7 @@
/* @internal */
namespace ts.server {
export class ThrottledOperations {
private readonly pendingTimeouts: Map<string, any> = createMap<any>();
private readonly pendingTimeouts: ESMap<string, any> = createMap<any>();
private readonly logger?: Logger | undefined;
constructor(private readonly host: ServerHost, logger: Logger) {
this.logger = logger.hasLevel(LogLevel.verbose) ? logger : undefined;

View File

@ -38,7 +38,7 @@ namespace ts.codefix {
interface Transformer {
readonly checker: TypeChecker;
readonly synthNamesMap: Map<string, SynthIdentifier>; // keys are the symbol id of the identifier
readonly synthNamesMap: ESMap<string, SynthIdentifier>; // keys are the symbol id of the identifier
readonly setOfExpressionsToReturn: ReadonlySet<number>; // keys are the node ids of the expressions
readonly isInJSFile: boolean;
}
@ -61,7 +61,7 @@ namespace ts.codefix {
return;
}
const synthNamesMap: Map<string, SynthIdentifier> = createMap();
const synthNamesMap: ESMap<string, SynthIdentifier> = createMap();
const isInJavascript = isInJSFile(functionToConvert);
const setOfExpressionsToReturn = getAllPromiseExpressionsToReturn(functionToConvert, checker);
const functionToConvertRenamed = renameCollidingVarNames(functionToConvert, checker, synthNamesMap, context.sourceFile);
@ -148,7 +148,7 @@ namespace ts.codefix {
This function collects all existing identifier names and names of identifiers that will be created in the refactor.
It then checks for any collisions and renames them through getSynthesizedDeepClone
*/
function renameCollidingVarNames(nodeToRename: FunctionLikeDeclaration, checker: TypeChecker, synthNamesMap: Map<string, SynthIdentifier>, sourceFile: SourceFile): FunctionLikeDeclaration {
function renameCollidingVarNames(nodeToRename: FunctionLikeDeclaration, checker: TypeChecker, synthNamesMap: ESMap<string, SynthIdentifier>, sourceFile: SourceFile): FunctionLikeDeclaration {
const identsToRenameMap = createMap<Identifier>(); // key is the symbol id
const collidingSymbolMap = createMultiMap<Symbol>();
forEachChild(nodeToRename, function visit(node: Node) {
@ -202,7 +202,7 @@ namespace ts.codefix {
return getSynthesizedDeepCloneWithRenames(nodeToRename, /*includeTrivia*/ true, identsToRenameMap, checker);
}
function getNewNameIfConflict(name: Identifier, originalNames: ReadonlyMap<string, Symbol[]>): SynthIdentifier {
function getNewNameIfConflict(name: Identifier, originalNames: ReadonlyESMap<string, Symbol[]>): SynthIdentifier {
const numVarsSameName = (originalNames.get(name.text) || emptyArray).length;
const identifier = numVarsSameName === 0 ? name : factory.createIdentifier(name.text + "_" + numVarsSameName);
return createSynthIdentifier(identifier);

View File

@ -60,7 +60,7 @@ namespace ts.codefix {
* export { _x as x };
* This conversion also must place if the exported name is not a valid identifier, e.g. `exports.class = 0;`.
*/
type ExportRenames = ReadonlyMap<string, string>;
type ExportRenames = ReadonlyESMap<string, string>;
function collectExportRenames(sourceFile: SourceFile, checker: TypeChecker, identifiers: Identifiers): ExportRenames {
const res = createMap<string>();
@ -444,7 +444,7 @@ namespace ts.codefix {
readonly additional: Set<string>;
}
type FreeIdentifiers = ReadonlyMap<string, readonly Identifier[]>;
type FreeIdentifiers = ReadonlyESMap<string, readonly Identifier[]>;
function collectFreeIdentifiers(file: SourceFile): FreeIdentifiers {
const map = createMultiMap<Identifier>();
forEachFreeIdentifier(file, id => map.add(id.text, id));

View File

@ -519,7 +519,7 @@ namespace ts.codefix {
program: Program,
useAutoImportProvider: boolean,
host: LanguageServiceHost
): ReadonlyMap<string, readonly SymbolExportInfo[]> {
): ReadonlyESMap<string, readonly SymbolExportInfo[]> {
// For each original symbol, keep all re-exports of that symbol together so we can call `getCodeActionsForImport` on the whole group at once.
// Maps symbol id to info for modules providing that symbol (original export + re-exports).
const originalSymbolToExportInfos = createMultiMap<SymbolExportInfo>();

View File

@ -118,7 +118,7 @@ namespace ts {
export function createDocumentRegistryInternal(useCaseSensitiveFileNames?: boolean, currentDirectory = "", externalCache?: ExternalDocumentCache): DocumentRegistry {
// Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have
// for those settings.
const buckets = new Map<string, Map<Path, DocumentRegistryEntry>>();
const buckets = new Map<string, ESMap<Path, DocumentRegistryEntry>>();
const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
function reportStats() {
@ -170,7 +170,7 @@ namespace ts {
acquiring: boolean,
scriptKind?: ScriptKind): SourceFile {
const bucket = getOrUpdate<Map<Path, DocumentRegistryEntry>>(buckets, key, createMap);
const bucket = getOrUpdate<ESMap<Path, DocumentRegistryEntry>>(buckets, key, createMap);
let entry = bucket.get(path);
const scriptTarget = scriptKind === ScriptKind.JSON ? ScriptTarget.JSON : compilationSettings.target || ScriptTarget.ES5;
if (!entry && externalCache) {

View File

@ -1754,7 +1754,7 @@ namespace ts.FindAllReferences {
* @param parent Another class or interface Symbol
* @param cachedResults A map of symbol id pairs (i.e. "child,parent") to booleans indicating previous results
*/
function explicitlyInheritsFrom(symbol: Symbol, parent: Symbol, cachedResults: Map<string, boolean>, checker: TypeChecker): boolean {
function explicitlyInheritsFrom(symbol: Symbol, parent: Symbol, cachedResults: ESMap<string, boolean>, checker: TypeChecker): boolean {
if (symbol === parent) {
return true;
}

View File

@ -40,7 +40,7 @@ namespace ts.FindAllReferences {
function getImportersForExport(
sourceFiles: readonly SourceFile[],
sourceFilesSet: ReadonlySet<string>,
allDirectImports: Map<string, ImporterOrCallExpression[]>,
allDirectImports: ESMap<string, ImporterOrCallExpression[]>,
{ exportingModuleSymbol, exportKind }: ExportInfo,
checker: TypeChecker,
cancellationToken: CancellationToken | undefined,
@ -368,7 +368,7 @@ namespace ts.FindAllReferences {
}
/** Returns a map from a module symbol Id to all import statements that directly reference the module. */
function getDirectImportsMap(sourceFiles: readonly SourceFile[], checker: TypeChecker, cancellationToken: CancellationToken | undefined): Map<string, ImporterOrCallExpression[]> {
function getDirectImportsMap(sourceFiles: readonly SourceFile[], checker: TypeChecker, cancellationToken: CancellationToken | undefined): ESMap<string, ImporterOrCallExpression[]> {
const map = createMap<ImporterOrCallExpression[]>();
for (const sourceFile of sourceFiles) {

View File

@ -33,8 +33,8 @@ namespace ts.NavigationBar {
let parentsStack: NavigationBarNode[] = [];
let parent: NavigationBarNode;
const trackedEs5ClassesStack: (Map<string, boolean> | undefined)[] = [];
let trackedEs5Classes: Map<string, boolean> | undefined;
const trackedEs5ClassesStack: (ESMap<string, boolean> | undefined)[] = [];
let trackedEs5Classes: ESMap<string, boolean> | undefined;
// NavigationBarItem requires an array, but will not mutate it, so just give it this for performance.
let emptyChildItemArray: NavigationBarItem[] = [];

View File

@ -115,7 +115,7 @@ namespace ts {
};
}
function getFullMatch(candidateContainers: readonly string[], candidate: string, dotSeparatedSegments: readonly Segment[], stringToWordSpans: Map<string, TextSpan[]>): PatternMatch | undefined {
function getFullMatch(candidateContainers: readonly string[], candidate: string, dotSeparatedSegments: readonly Segment[], stringToWordSpans: ESMap<string, TextSpan[]>): PatternMatch | undefined {
// First, check that the last part of the dot separated pattern matches the name of the
// candidate. If not, then there's no point in proceeding and doing the more
// expensive work.
@ -141,7 +141,7 @@ namespace ts {
return bestMatch;
}
function getWordSpans(word: string, stringToWordSpans: Map<string, TextSpan[]>): TextSpan[] {
function getWordSpans(word: string, stringToWordSpans: ESMap<string, TextSpan[]>): TextSpan[] {
let spans = stringToWordSpans.get(word);
if (!spans) {
stringToWordSpans.set(word, spans = breakIntoWordSpans(word));
@ -149,7 +149,7 @@ namespace ts {
return spans;
}
function matchTextChunk(candidate: string, chunk: TextChunk, stringToWordSpans: Map<string, TextSpan[]>): PatternMatch | undefined {
function matchTextChunk(candidate: string, chunk: TextChunk, stringToWordSpans: ESMap<string, TextSpan[]>): PatternMatch | undefined {
const index = indexOfIgnoringCase(candidate, chunk.textLowerCase);
if (index === 0) {
// a) Check if the word is a prefix of the candidate, in a case insensitive or
@ -201,7 +201,7 @@ namespace ts {
}
}
function matchSegment(candidate: string, segment: Segment, stringToWordSpans: Map<string, TextSpan[]>): PatternMatch | undefined {
function matchSegment(candidate: string, segment: Segment, stringToWordSpans: ESMap<string, TextSpan[]>): PatternMatch | undefined {
// First check if the segment matches as is. This is also useful if the segment contains
// characters we would normally strip when splitting into parts that we also may want to
// match in the candidate. For example if the segment is "@int" and the candidate is

View File

@ -2,7 +2,7 @@
namespace ts.refactor {
// A map with the refactor code as key, the refactor itself as value
// e.g. nonSuggestableRefactors[refactorCode] -> the refactor you want
const refactors: Map<string, Refactor> = createMap<Refactor>();
const refactors: ESMap<string, Refactor> = createMap<Refactor>();
/** @param name An unique code associated with each refactor. Does not have to be human-readable. */
export function registerRefactor(name: string, refactor: Refactor) {

View File

@ -43,11 +43,11 @@ namespace ts.refactor.extractSymbol {
}
const functionActions: RefactorActionInfo[] = [];
const usedFunctionNames: Map<string, boolean> = createMap();
const usedFunctionNames: ESMap<string, boolean> = createMap();
let innermostErrorFunctionAction: RefactorActionInfo | undefined;
const constantActions: RefactorActionInfo[] = [];
const usedConstantNames: Map<string, boolean> = createMap();
const usedConstantNames: ESMap<string, boolean> = createMap();
let innermostErrorConstantAction: RefactorActionInfo | undefined;
let i = 0;
@ -1322,7 +1322,7 @@ namespace ts.refactor.extractSymbol {
}
}
function transformFunctionBody(body: Node, exposedVariableDeclarations: readonly VariableDeclaration[], writes: readonly UsageEntry[] | undefined, substitutions: ReadonlyMap<string, Node>, hasReturn: boolean): { body: Block, returnValueProperty: string | undefined } {
function transformFunctionBody(body: Node, exposedVariableDeclarations: readonly VariableDeclaration[], writes: readonly UsageEntry[] | undefined, substitutions: ReadonlyESMap<string, Node>, hasReturn: boolean): { body: Block, returnValueProperty: string | undefined } {
const hasWritesOrVariableDeclarations = writes !== undefined || exposedVariableDeclarations.length > 0;
if (isBlock(body) && !hasWritesOrVariableDeclarations && substitutions.size === 0) {
// already block, no declarations or writes to propagate back, no substitutions - can use node as is
@ -1378,7 +1378,7 @@ namespace ts.refactor.extractSymbol {
}
}
function transformConstantInitializer(initializer: Expression, substitutions: ReadonlyMap<string, Node>): Expression {
function transformConstantInitializer(initializer: Expression, substitutions: ReadonlyESMap<string, Node>): Expression {
return substitutions.size
? visitor(initializer) as Expression
: initializer;
@ -1526,9 +1526,9 @@ namespace ts.refactor.extractSymbol {
}
interface ScopeUsages {
readonly usages: Map<string, UsageEntry>;
readonly typeParameterUsages: Map<string, TypeParameter>; // Key is type ID
readonly substitutions: Map<string, Node>;
readonly usages: ESMap<string, UsageEntry>;
readonly typeParameterUsages: ESMap<string, TypeParameter>; // Key is type ID
readonly substitutions: ESMap<string, Node>;
}
interface ReadsAndWrites {
@ -1548,7 +1548,7 @@ namespace ts.refactor.extractSymbol {
const allTypeParameterUsages = createMap<TypeParameter>(); // Key is type ID
const usagesPerScope: ScopeUsages[] = [];
const substitutionsPerScope: Map<string, Node>[] = [];
const substitutionsPerScope: ESMap<string, Node>[] = [];
const functionErrorsPerScope: Diagnostic[][] = [];
const constantErrorsPerScope: Diagnostic[][] = [];
const visibleDeclarationsInExtractedRange: NamedDeclaration[] = [];

View File

@ -634,13 +634,13 @@ namespace ts {
public scriptKind!: ScriptKind;
public languageVersion!: ScriptTarget;
public languageVariant!: LanguageVariant;
public identifiers!: Map<string, string>;
public identifiers!: ESMap<string, string>;
public nameTable: UnderscoreEscapedMap<number> | undefined;
public resolvedModules: Map<string, ResolvedModuleFull> | undefined;
public resolvedTypeReferenceDirectiveNames!: Map<string, ResolvedTypeReferenceDirective>;
public resolvedModules: ESMap<string, ResolvedModuleFull> | undefined;
public resolvedTypeReferenceDirectiveNames!: ESMap<string, ResolvedTypeReferenceDirective>;
public imports!: readonly StringLiteralLike[];
public moduleAugmentations!: StringLiteral[];
private namedDeclarations: Map<string, Declaration[]> | undefined;
private namedDeclarations: ESMap<string, Declaration[]> | undefined;
public ambientModuleNames!: string[];
public checkJsDirective: CheckJsDirective | undefined;
public errorExpectations: TextRange[] | undefined;
@ -686,7 +686,7 @@ namespace ts {
return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos;
}
public getNamedDeclarations(): Map<string, Declaration[]> {
public getNamedDeclarations(): ESMap<string, Declaration[]> {
if (!this.namedDeclarations) {
this.namedDeclarations = this.computeNamedDeclarations();
}
@ -694,7 +694,7 @@ namespace ts {
return this.namedDeclarations;
}
private computeNamedDeclarations(): Map<string, Declaration[]> {
private computeNamedDeclarations(): ESMap<string, Declaration[]> {
const result = createMultiMap<Declaration>();
this.forEachChild(visit);
@ -937,7 +937,7 @@ namespace ts {
// at each language service public entry point, since we don't know when
// the set of scripts handled by the host changes.
class HostCache {
private fileNameToEntry: Map<Path, CachedHostFileInformation>;
private fileNameToEntry: ESMap<Path, CachedHostFileInformation>;
private _compilationSettings: CompilerOptions;
private currentDirectory: string;

View File

@ -25,11 +25,11 @@ namespace ts {
fileNames: string[]; // The file names that belong to the same project.
projectRootPath: string; // The path to the project root directory
safeListPath: string; // The path used to retrieve the safe list
packageNameToTypingLocation: Map<string, JsTyping.CachedTyping>; // The map of package names to their cached typing locations and installed versions
packageNameToTypingLocation: ESMap<string, JsTyping.CachedTyping>; // The map of package names to their cached typing locations and installed versions
typeAcquisition: TypeAcquisition; // Used to customize the type acquisition process
compilerOptions: CompilerOptions; // Used as a source for typing inference
unresolvedImports: readonly string[]; // List of unresolved module ids from imports
typesRegistry: ReadonlyMap<string, MapLike<string>>; // The map of available typings in npm to maps of TS versions to their latest supported versions
typesRegistry: ReadonlyESMap<string, MapLike<string>>; // The map of available typings in npm to maps of TS versions to their latest supported versions
}
export interface ScriptSnapshotShim {

View File

@ -92,7 +92,7 @@ namespace ts {
/* @internal */ scriptSnapshot: IScriptSnapshot | undefined;
/* @internal */ nameTable: UnderscoreEscapedMap<number> | undefined;
/* @internal */ getNamedDeclarations(): Map<string, readonly Declaration[]>;
/* @internal */ getNamedDeclarations(): ESMap<string, readonly Declaration[]>;
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
getLineEndOfPosition(pos: number): number;
@ -196,10 +196,10 @@ namespace ts {
export interface PackageJsonInfo {
fileName: string;
parseable: boolean;
dependencies?: Map<string, string>;
devDependencies?: Map<string, string>;
peerDependencies?: Map<string, string>;
optionalDependencies?: Map<string, string>;
dependencies?: ESMap<string, string>;
devDependencies?: ESMap<string, string>;
peerDependencies?: ESMap<string, string>;
optionalDependencies?: ESMap<string, string>;
get(dependencyName: string, inGroups?: PackageJsonDependencyGroup): string | undefined;
has(dependencyName: string, inGroups?: PackageJsonDependencyGroup): boolean;
}
@ -271,7 +271,7 @@ namespace ts {
/* @internal */
getGlobalTypingsCacheLocation?(): string | undefined;
/* @internal */
getProbableSymlinks?(files: readonly SourceFile[]): ReadonlyMap<string, string>;
getProbableSymlinks?(files: readonly SourceFile[]): ReadonlyESMap<string, string>;
/*
* Required for full import and type reference completions.

View File

@ -2186,7 +2186,7 @@ namespace ts {
return clone;
}
export function getSynthesizedDeepCloneWithRenames<T extends Node>(node: T, includeTrivia = true, renameMap?: Map<string, Identifier>, checker?: TypeChecker, callback?: (originalNode: Node, clone: Node) => any): T {
export function getSynthesizedDeepCloneWithRenames<T extends Node>(node: T, includeTrivia = true, renameMap?: ESMap<string, Identifier>, checker?: TypeChecker, callback?: (originalNode: Node, clone: Node) => any): T {
let clone;
if (renameMap && checker && isBindingElement(node) && isIdentifier(node.name) && isObjectBindingPattern(node.parent)) {
const symbol = checker.getSymbolAtLocation(node.name);
@ -2222,7 +2222,7 @@ namespace ts {
}
function getSynthesizedDeepCloneWorker<T extends Node>(node: T, renameMap?: Map<string, Identifier>, checker?: TypeChecker, callback?: (originalNode: Node, clone: Node) => any): T {
function getSynthesizedDeepCloneWorker<T extends Node>(node: T, renameMap?: ESMap<string, Identifier>, checker?: TypeChecker, callback?: (originalNode: Node, clone: Node) => any): T {
const visited = (renameMap || checker || callback) ?
visitEachChild(node, wrapper, nullTransformationContext) :
visitEachChild(node, getSynthesizedDeepClone, nullTransformationContext);

View File

@ -301,9 +301,9 @@ namespace Harness.Parallel.Worker {
// The root suite for all unit tests.
let unitTestSuite: Suite;
let unitTestSuiteMap: ts.Map<string, Mocha.Suite>;
let unitTestSuiteMap: ts.ESMap<string, Mocha.Suite>;
// (Unit) Tests directly within the root suite
let unitTestTestMap: ts.Map<string, Mocha.Test>;
let unitTestTestMap: ts.ESMap<string, Mocha.Test>;
if (runUnitTests) {
unitTestSuite = new Suite("", new Mocha.Context());

View File

@ -493,7 +493,7 @@ namespace ts {
}
interface VerifyNullNonIncludedOption {
type: () => "string" | "number" | Map<string, number | string>;
type: () => "string" | "number" | ESMap<string, number | string>;
nonNullValue?: string;
}
function verifyNullNonIncludedOption({ type, nonNullValue }: VerifyNullNonIncludedOption) {

View File

@ -35,7 +35,7 @@ namespace ts {
"Y"
];
function testMapIterationAddedValues<K>(keys: K[], map: Map<K, string>, useForEach: boolean): string {
function testMapIterationAddedValues<K>(keys: K[], map: ESMap<K, string>, useForEach: boolean): string {
let resultString = "";
map.set(keys[0], "1");
@ -117,13 +117,13 @@ namespace ts {
let MapShim!: MapConstructor;
beforeEach(() => {
function getIterator<I extends readonly any[] | ReadonlySet<any> | ReadonlyMap<any, any> | undefined>(iterable: I): Iterator<
I extends ReadonlyMap<infer K, infer V> ? [K, V] :
function getIterator<I extends readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined>(iterable: I): Iterator<
I extends ReadonlyESMap<infer K, infer V> ? [K, V] :
I extends ReadonlySet<infer T> ? T :
I extends readonly (infer T)[] ? T :
I extends undefined ? undefined :
never>;
function getIterator(iterable: readonly any[] | ReadonlySet<any> | ReadonlyMap<any, any> | undefined): Iterator<any> | undefined {
function getIterator(iterable: readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined): Iterator<any> | undefined {
// override `ts.getIterator` with a version that allows us to iterate over a `MapShim` in an environment with a native `Map`.
if (iterable instanceof MapShim) return iterable.entries();
return ts.getIterator(iterable);

View File

@ -115,13 +115,13 @@ namespace ts {
let SetShim!: SetConstructor;
beforeEach(() => {
function getIterator<I extends readonly any[] | ReadonlySet<any> | ReadonlyMap<any, any> | undefined>(iterable: I): Iterator<
I extends ReadonlyMap<infer K, infer V> ? [K, V] :
function getIterator<I extends readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined>(iterable: I): Iterator<
I extends ReadonlyESMap<infer K, infer V> ? [K, V] :
I extends ReadonlySet<infer T> ? T :
I extends readonly (infer T)[] ? T :
I extends undefined ? undefined :
never>;
function getIterator(iterable: readonly any[] | ReadonlySet<any> | ReadonlyMap<any, any> | undefined): Iterator<any> | undefined {
function getIterator(iterable: readonly any[] | ReadonlySet<any> | ReadonlyESMap<any, any> | undefined): Iterator<any> | undefined {
// override `ts.getIterator` with a version that allows us to iterate over a `SetShim` in an environment with a native `Set`.
if (iterable instanceof SetShim) return iterable.values();
return ts.getIterator(iterable);

View File

@ -458,7 +458,7 @@ namespace ts {
});
describe("unittests:: moduleResolution:: Relative imports", () => {
function test(files: Map<string, string>, currentDirectory: string, rootFiles: string[], expectedFilesCount: number, relativeNamesToCheck: string[]) {
function test(files: ESMap<string, string>, currentDirectory: string, rootFiles: string[], expectedFilesCount: number, relativeNamesToCheck: string[]) {
const options: CompilerOptions = { module: ModuleKind.CommonJS };
const host: CompilerHost = {
getSourceFile: (fileName: string, languageVersion: ScriptTarget) => {
@ -533,7 +533,7 @@ export = C;
describe("unittests:: moduleResolution:: Files with different casing with forceConsistentCasingInFileNames", () => {
let library: SourceFile;
function test(
files: Map<string, string>,
files: ESMap<string, string>,
options: CompilerOptions,
currentDirectory: string,
useCaseSensitiveFileNames: boolean,

View File

@ -1,7 +1,7 @@
namespace ts {
function verifyMissingFilePaths(missingPaths: readonly Path[], expected: readonly string[]) {
assert.isDefined(missingPaths);
const map = arrayToSet(expected) as Map<string, boolean>;
const map = arrayToSet(expected) as ESMap<string, boolean>;
for (const missing of missingPaths) {
const value = map.get(missing);
assert.isTrue(value, `${missing} to be ${value === undefined ? "not present" : "present only once"}, in actual: ${missingPaths} expected: ${expected}`);

View File

@ -175,7 +175,7 @@ namespace ts {
return true;
}
function checkCache<T>(caption: string, program: Program, fileName: string, expectedContent: Map<string, T> | undefined, getCache: (f: SourceFile) => Map<string, T> | undefined, entryChecker: (expected: T, original: T) => boolean): void {
function checkCache<T>(caption: string, program: Program, fileName: string, expectedContent: ESMap<string, T> | undefined, getCache: (f: SourceFile) => ESMap<string, T> | undefined, entryChecker: (expected: T, original: T) => boolean): void {
const file = program.getSourceFile(fileName);
assert.isTrue(file !== undefined, `cannot find file ${fileName}`);
const cache = getCache(file!);
@ -189,7 +189,7 @@ namespace ts {
}
/** True if the maps have the same keys and values. */
function mapsAreEqual<T>(left: Map<string, T>, right: Map<string, T>, valuesAreEqual?: (left: T, right: T) => boolean): boolean {
function mapsAreEqual<T>(left: ESMap<string, T>, right: ESMap<string, T>, valuesAreEqual?: (left: T, right: T) => boolean): boolean {
if (left === right) return true;
if (!left || !right) return false;
const someInLeftHasNoMatch = forEachEntry(left, (leftValue, leftKey) => {
@ -202,11 +202,11 @@ namespace ts {
return !someInRightHasNoMatch;
}
function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map<string, ResolvedModule | undefined> | undefined): void {
function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: ESMap<string, ResolvedModule | undefined> | undefined): void {
checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, checkResolvedModule);
}
function checkResolvedTypeDirectivesCache(program: Program, fileName: string, expectedContent: Map<string, ResolvedTypeReferenceDirective> | undefined): void {
function checkResolvedTypeDirectivesCache(program: Program, fileName: string, expectedContent: ESMap<string, ResolvedTypeReferenceDirective> | undefined): void {
checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective);
}

View File

@ -7,7 +7,7 @@ namespace ts {
interface Test {
source: string;
ranges: Map<string, Range>;
ranges: ESMap<string, Range>;
}
export function extractTest(source: string): Test {

View File

@ -11,7 +11,7 @@ namespace ts.tscWatch {
);
});
function verifyWatchFileOnMultipleProjects(singleWatchPerFile: boolean, environmentVariables?: Map<string, string>) {
function verifyWatchFileOnMultipleProjects(singleWatchPerFile: boolean, environmentVariables?: ESMap<string, string>) {
it("watchFile on same file multiple times because file is part of multiple projects", () => {
const project = `${TestFSWithWatch.tsbuildProjectsLocation}/myproject`;
let maxPkgs = 4;

View File

@ -65,7 +65,7 @@ namespace ts.projectSystem {
assert.equal(calledMap.size, 0, `${callback} shouldn't be called: ${arrayFrom(calledMap.keys())}`);
}
function verifyCalledOnEachEntry(callback: CalledMaps, expectedKeys: Map<string, number>) {
function verifyCalledOnEachEntry(callback: CalledMaps, expectedKeys: ESMap<string, number>) {
TestFSWithWatch.checkMap<true | CalledWithFiveArgs>(callback, calledMaps[callback], expectedKeys);
}

View File

@ -165,7 +165,7 @@ namespace ts.projectSystem {
return JSON.stringify({ dependencies });
}
export function createTypesRegistry(...list: string[]): Map<string, MapLike<string>> {
export function createTypesRegistry(...list: string[]): ESMap<string, MapLike<string>> {
const versionMap = {
"latest": "1.3.0",
"ts2.0": "1.0.0",
@ -489,7 +489,7 @@ namespace ts.projectSystem {
}
export function checkOpenFiles(projectService: server.ProjectService, expectedFiles: File[]) {
checkArray("Open files", arrayFrom(projectService.openFiles.keys(), path => projectService.getScriptInfoForPath(path)!.fileName), expectedFiles.map(file => file.path));
checkArray("Open files", arrayFrom(projectService.openFiles.keys(), path => projectService.getScriptInfoForPath(path as Path)!.fileName), expectedFiles.map(file => file.path));
}
export function checkScriptInfos(projectService: server.ProjectService, expectedFiles: readonly string[], additionInfo?: string) {

View File

@ -161,7 +161,7 @@ new C();`
});
}
function verifyWatchedFilesAndDirectories(host: TestServerHost, files: string[], recursiveDirectories: ReadonlyMap<string, number>, nonRecursiveDirectories: string[]) {
function verifyWatchedFilesAndDirectories(host: TestServerHost, files: string[], recursiveDirectories: ReadonlyESMap<string, number>, nonRecursiveDirectories: string[]) {
checkWatchedFilesDetailed(host, files.filter(f => f !== recognizersDateTimeSrcFile.path), 1);
checkWatchedDirectoriesDetailed(host, nonRecursiveDirectories, 1, /*recursive*/ false);
checkWatchedDirectoriesDetailed(host, recursiveDirectories, /*recursive*/ true);

View File

@ -5,7 +5,7 @@ namespace ts.projectSystem {
interface InstallerParams {
globalTypingsCacheLocation?: string;
throttleLimit?: number;
typesRegistry?: Map<string, MapLike<string>>;
typesRegistry?: ESMap<string, MapLike<string>>;
}
class Installer extends TestTypingsInstaller {

View File

@ -233,7 +233,7 @@ namespace ts.server {
private requestMap = createMap<QueuedOperation>(); // Maps operation ID to newest requestQueue entry with that ID
/** We will lazily request the types registry on the first call to `isKnownTypesPackageName` and store it in `typesRegistryCache`. */
private requestedRegistry = false;
private typesRegistryCache: Map<string, MapLike<string>> | undefined;
private typesRegistryCache: ESMap<string, MapLike<string>> | undefined;
// This number is essentially arbitrary. Processing more than one typings request
// at a time makes sense, but having too many in the pipe results in a hang

View File

@ -46,7 +46,7 @@ namespace ts.server.typingsInstaller {
entries: MapLike<MapLike<string>>;
}
function loadTypesRegistryFile(typesRegistryFilePath: string, host: InstallTypingHost, log: Log): Map<string, MapLike<string>> {
function loadTypesRegistryFile(typesRegistryFilePath: string, host: InstallTypingHost, log: Log): ESMap<string, MapLike<string>> {
if (!host.fileExists(typesRegistryFilePath)) {
if (log.isEnabled()) {
log.writeLine(`Types registry file '${typesRegistryFilePath}' does not exist`);
@ -79,7 +79,7 @@ namespace ts.server.typingsInstaller {
export class NodeTypingsInstaller extends TypingsInstaller {
private readonly nodeExecSync: ExecSync;
private readonly npmPath: string;
readonly typesRegistry: Map<string, MapLike<string>>;
readonly typesRegistry: ESMap<string, MapLike<string>>;
private delayedInitializationError: InitializationFailedResponse | undefined;

View File

@ -84,10 +84,10 @@ namespace ts.server.typingsInstaller {
DirectoryWatcher = "DirectoryWatcher"
}
type ProjectWatchers = Map<string, FileWatcher> & { isInvoked?: boolean; };
type ProjectWatchers = ESMap<string, FileWatcher> & { isInvoked?: boolean; };
export abstract class TypingsInstaller {
private readonly packageNameToTypingLocation: Map<string, JsTyping.CachedTyping> = createMap<JsTyping.CachedTyping>();
private readonly packageNameToTypingLocation: ESMap<string, JsTyping.CachedTyping> = createMap<JsTyping.CachedTyping>();
private readonly missingTypingsSet = new Set<string>();
private readonly knownCachesSet = new Set<string>();
private readonly projectWatchers = createMap<ProjectWatchers>();
@ -99,7 +99,7 @@ namespace ts.server.typingsInstaller {
private installRunCount = 1;
private inFlightRequestCount = 0;
abstract readonly typesRegistry: Map<string, MapLike<string>>;
abstract readonly typesRegistry: ESMap<string, MapLike<string>>;
constructor(
protected readonly installTypingHost: InstallTypingHost,

View File

@ -43,16 +43,28 @@ declare namespace ts {
clear(): void;
}
/** ES6 Map interface, only read methods included. */
interface ReadonlyMap<K, V> extends ReadonlyCollection<K> {
interface ReadonlyESMap<K, V> extends ReadonlyCollection<K> {
get(key: K): V | undefined;
values(): Iterator<V>;
entries(): Iterator<[K, V]>;
forEach(action: (value: V, key: K) => void): void;
}
/**
* ES6 Map interface, only read methods included.
* @deprecated Use `ts.ReadonlyESMap<K, V>` instead.
*/
interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
}
/** ES6 Map interface. */
interface Map<K, V> extends ReadonlyMap<K, V>, Collection<K> {
interface ESMap<K, V> extends ReadonlyESMap<K, V>, Collection<K> {
set(key: K, value: V): this;
}
/**
* ES6 Map interface.
* @deprecated Use `ts.ESMap<K, V>` instead.
*/
interface Map<T> extends ESMap<string, T> {
}
/** ES6 Set interface, only read methods included. */
interface ReadonlySet<T> extends ReadonlyCollection<T> {
has(value: T): boolean;
@ -2405,10 +2417,10 @@ declare namespace ts {
__escapedIdentifier: void;
}) | InternalSymbolName;
/** ReadonlyMap where keys are `__String`s. */
export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyMap<__String, T> {
export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyESMap<__String, T> {
}
/** Map where keys are `__String`s. */
export interface UnderscoreEscapedMap<T> extends Map<__String, T>, ReadonlyUnderscoreEscapedMap<T> {
export interface UnderscoreEscapedMap<T> extends ESMap<__String, T>, ReadonlyUnderscoreEscapedMap<T> {
}
/** SymbolTable based on ES6 Map interface. */
export type SymbolTable = UnderscoreEscapedMap<Symbol>;
@ -2600,7 +2612,7 @@ declare namespace ts {
isDistributive: boolean;
inferTypeParameters?: TypeParameter[];
outerTypeParameters?: TypeParameter[];
instantiations?: Map<string, Type>;
instantiations?: Map<Type>;
aliasSymbol?: Symbol;
aliasTypeArguments?: Type[];
}
@ -4492,7 +4504,7 @@ declare namespace ts {
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
export function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): ParsedCommandLine | undefined;
export function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): ParsedCommandLine | undefined;
/**
* Read tsconfig.json file
* @param fileName The path to the config file
@ -4526,7 +4538,7 @@ declare namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
/**
* Parse the contents of a config file (tsconfig.json).
* @param jsonNode The contents of the config file to parse
@ -4534,7 +4546,7 @@ declare namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
export interface ParsedTsconfig {
raw: any;
options?: CompilerOptions;
@ -4581,7 +4593,7 @@ declare namespace ts {
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
*/
interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<string, ResolvedModuleWithFailedLookupLocations>;
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<ResolvedModuleWithFailedLookupLocations>;
}
/**
* Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
@ -9200,8 +9212,8 @@ declare namespace ts.server {
filesToString(writeProjectFileNames: boolean): string;
setCompilerOptions(compilerOptions: CompilerOptions): void;
protected removeRoot(info: ScriptInfo): void;
protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map<string, any> | undefined): void;
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<string, any> | undefined): void;
protected enableGlobalPlugins(options: CompilerOptions, pluginConfigOverrides: Map<any> | undefined): void;
protected enablePlugin(pluginConfigEntry: PluginImport, searchPaths: string[], pluginConfigOverrides: Map<any> | undefined): void;
private enableProxy;
/** Starts a new check for diagnostics. Call this if some file has updated that would cause diagnostics to be changed. */
refreshDiagnostics(): void;
@ -9469,11 +9481,11 @@ declare namespace ts.server {
/**
* projects specified by a tsconfig.json file
*/
readonly configuredProjects: Map<string, ConfiguredProject>;
readonly configuredProjects: Map<ConfiguredProject>;
/**
* Open files: with value being project root path, and key being Path of the file that is open
*/
readonly openFiles: Map<Path, NormalizedPath | undefined>;
readonly openFiles: Map<NormalizedPath | undefined>;
/**
* Map of open files that are opened without complete path but have projectRoot as current directory
*/

View File

@ -43,16 +43,28 @@ declare namespace ts {
clear(): void;
}
/** ES6 Map interface, only read methods included. */
interface ReadonlyMap<K, V> extends ReadonlyCollection<K> {
interface ReadonlyESMap<K, V> extends ReadonlyCollection<K> {
get(key: K): V | undefined;
values(): Iterator<V>;
entries(): Iterator<[K, V]>;
forEach(action: (value: V, key: K) => void): void;
}
/**
* ES6 Map interface, only read methods included.
* @deprecated Use `ts.ReadonlyESMap<K, V>` instead.
*/
interface ReadonlyMap<T> extends ReadonlyESMap<string, T> {
}
/** ES6 Map interface. */
interface Map<K, V> extends ReadonlyMap<K, V>, Collection<K> {
interface ESMap<K, V> extends ReadonlyESMap<K, V>, Collection<K> {
set(key: K, value: V): this;
}
/**
* ES6 Map interface.
* @deprecated Use `ts.ESMap<K, V>` instead.
*/
interface Map<T> extends ESMap<string, T> {
}
/** ES6 Set interface, only read methods included. */
interface ReadonlySet<T> extends ReadonlyCollection<T> {
has(value: T): boolean;
@ -2405,10 +2417,10 @@ declare namespace ts {
__escapedIdentifier: void;
}) | InternalSymbolName;
/** ReadonlyMap where keys are `__String`s. */
export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyMap<__String, T> {
export interface ReadonlyUnderscoreEscapedMap<T> extends ReadonlyESMap<__String, T> {
}
/** Map where keys are `__String`s. */
export interface UnderscoreEscapedMap<T> extends Map<__String, T>, ReadonlyUnderscoreEscapedMap<T> {
export interface UnderscoreEscapedMap<T> extends ESMap<__String, T>, ReadonlyUnderscoreEscapedMap<T> {
}
/** SymbolTable based on ES6 Map interface. */
export type SymbolTable = UnderscoreEscapedMap<Symbol>;
@ -2600,7 +2612,7 @@ declare namespace ts {
isDistributive: boolean;
inferTypeParameters?: TypeParameter[];
outerTypeParameters?: TypeParameter[];
instantiations?: Map<string, Type>;
instantiations?: Map<Type>;
aliasSymbol?: Symbol;
aliasTypeArguments?: Type[];
}
@ -4492,7 +4504,7 @@ declare namespace ts {
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
export function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): ParsedCommandLine | undefined;
export function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>, watchOptionsToExtend?: WatchOptions, extraFileExtensions?: readonly FileExtensionInfo[]): ParsedCommandLine | undefined;
/**
* Read tsconfig.json file
* @param fileName The path to the config file
@ -4526,7 +4538,7 @@ declare namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
/**
* Parse the contents of a config file (tsconfig.json).
* @param jsonNode The contents of the config file to parse
@ -4534,7 +4546,7 @@ declare namespace ts {
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<string, ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
export function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: readonly FileExtensionInfo[], extendedConfigCache?: Map<ExtendedConfigCacheEntry>, existingWatchOptions?: WatchOptions): ParsedCommandLine;
export interface ParsedTsconfig {
raw: any;
options?: CompilerOptions;
@ -4581,7 +4593,7 @@ declare namespace ts {
* This assumes that any module id will have the same resolution for sibling files located in the same folder.
*/
interface ModuleResolutionCache extends NonRelativeModuleNameResolutionCache {
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<string, ResolvedModuleWithFailedLookupLocations>;
getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): Map<ResolvedModuleWithFailedLookupLocations>;
}
/**
* Stored map from non-relative module name to a table: directory -> result of module lookup in this directory