@typescript-deploys/pr-build 4.9.0-pr-50397-33 → 4.9.0-pr-50247-13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1788,7 +1788,7 @@ declare namespace ts {
1788
1788
  }
1789
1789
  export interface FileReference extends TextRange {
1790
1790
  fileName: string;
1791
- resolutionMode?: SourceFile["impliedNodeFormat"];
1791
+ resolutionMode?: ResolutionMode;
1792
1792
  }
1793
1793
  export interface CheckJsDirective extends TextRange {
1794
1794
  enabled: boolean;
@@ -2103,7 +2103,7 @@ declare namespace ts {
2103
2103
  * of `node`). If so, this field will be unset and source files will be considered to be
2104
2104
  * CommonJS-output-format by the node module transformer and type checker, regardless of extension or context.
2105
2105
  */
2106
- impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
2106
+ impliedNodeFormat?: ResolutionMode;
2107
2107
  }
2108
2108
  export interface Bundle extends Node {
2109
2109
  readonly kind: SyntaxKind.Bundle;
@@ -2832,7 +2832,7 @@ declare namespace ts {
2832
2832
  export interface SubstitutionType extends InstantiableType {
2833
2833
  objectFlags: ObjectFlags;
2834
2834
  baseType: Type;
2835
- constraint: Type;
2835
+ substitute: Type;
2836
2836
  }
2837
2837
  export enum SignatureKind {
2838
2838
  Call = 0,
@@ -3048,6 +3048,7 @@ declare namespace ts {
3048
3048
  jsxImportSource?: string;
3049
3049
  composite?: boolean;
3050
3050
  incremental?: boolean;
3051
+ cacheResolutions?: boolean;
3051
3052
  tsBuildInfoFile?: string;
3052
3053
  removeComments?: boolean;
3053
3054
  rootDir?: string;
@@ -3273,7 +3274,7 @@ declare namespace ts {
3273
3274
  readonly resolvedModule: ResolvedModuleFull | undefined;
3274
3275
  }
3275
3276
  export interface ResolvedTypeReferenceDirective {
3276
- primary: boolean;
3277
+ primary: boolean | undefined;
3277
3278
  resolvedFileName: string | undefined;
3278
3279
  packageId?: PackageId;
3279
3280
  /** True if `resolvedFileName` comes from `node_modules`. */
@@ -3283,6 +3284,13 @@ declare namespace ts {
3283
3284
  readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined;
3284
3285
  readonly failedLookupLocations: string[];
3285
3286
  }
3287
+ export interface PartialResolutionInfo {
3288
+ reusedNames: {
3289
+ name: string;
3290
+ mode: ResolutionMode;
3291
+ }[] | undefined;
3292
+ namesIndex: readonly number[];
3293
+ }
3286
3294
  export interface CompilerHost extends ModuleResolutionHost {
3287
3295
  getSourceFile(fileName: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3288
3296
  getSourceFileByPath?(fileName: string, path: Path, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
@@ -3295,7 +3303,7 @@ declare namespace ts {
3295
3303
  useCaseSensitiveFileNames(): boolean;
3296
3304
  getNewLine(): string;
3297
3305
  readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[];
3298
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
3306
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, partialResolutionInfo?: PartialResolutionInfo): ResolvedModuleWithFailedLookupLocations[] | (ResolvedModule | undefined)[];
3299
3307
  /**
3300
3308
  * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
3301
3309
  */
@@ -3303,7 +3311,7 @@ declare namespace ts {
3303
3311
  /**
3304
3312
  * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
3305
3313
  */
3306
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
3314
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode, partialResolutionInfo?: PartialResolutionInfo): ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] | (ResolvedTypeReferenceDirective | undefined)[];
3307
3315
  getEnvironmentVariable?(name: string): string | undefined;
3308
3316
  createHash?(data: string): string;
3309
3317
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
@@ -4859,7 +4867,7 @@ declare namespace ts {
4859
4867
  * and files on disk, but needs to be done with a module resolution cache in scope to be performant.
4860
4868
  * This is usually `undefined` for compilations that do not have `moduleResolution` values of `node16` or `nodenext`.
4861
4869
  */
4862
- impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
4870
+ impliedNodeFormat?: ResolutionMode;
4863
4871
  /**
4864
4872
  * Controls how module-y-ness is set for the given file. Usually the result of calling
4865
4873
  * `getSetExternalModuleIndicator` on a valid `CompilerOptions` object. If not present, the default
@@ -4974,7 +4982,7 @@ declare namespace ts {
4974
4982
  * This is possible in case if resolution is performed for directives specified via 'types' parameter. In this case initial path for secondary lookups
4975
4983
  * is assumed to be the same as root directory of the project.
4976
4984
  */
4977
- export function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference, cache?: TypeReferenceDirectiveResolutionCache, resolutionMode?: SourceFile["impliedNodeFormat"]): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
4985
+ export function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost, redirectedReference?: ResolvedProjectReference, cache?: TypeReferenceDirectiveResolutionCache, resolutionMode?: ResolutionMode): ResolvedTypeReferenceDirectiveWithFailedLookupLocations;
4978
4986
  /**
4979
4987
  * Given a set of options, returns the set of type directive names
4980
4988
  * that should be included for this program automatically.
@@ -4986,12 +4994,13 @@ declare namespace ts {
4986
4994
  export function getAutomaticTypeDirectiveNames(options: CompilerOptions, host: ModuleResolutionHost): string[];
4987
4995
  export interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
4988
4996
  }
4997
+ export type ResolutionMode = ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
4989
4998
  export interface ModeAwareCache<T> {
4990
- get(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined): T | undefined;
4991
- set(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined, value: T): this;
4992
- delete(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined): this;
4993
- has(key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined): boolean;
4994
- forEach(cb: (elem: T, key: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined) => void): void;
4999
+ get(key: string, mode: ResolutionMode): T | undefined;
5000
+ set(key: string, mode: ResolutionMode, value: T): this;
5001
+ delete(key: string, mode: ResolutionMode): this;
5002
+ has(key: string, mode: ResolutionMode): boolean;
5003
+ forEach(cb: (elem: T, key: string, mode: ResolutionMode) => void): void;
4995
5004
  size(): number;
4996
5005
  }
4997
5006
  /**
@@ -4999,6 +5008,7 @@ declare namespace ts {
4999
5008
  * This assumes that any module id will have the same resolution for sibling files located in the same folder.
5000
5009
  */
5001
5010
  export interface PerDirectoryResolutionCache<T> {
5011
+ getFromCache(directoryName: string, name: string, mode: ResolutionMode, redirectedReference?: ResolvedProjectReference): T | undefined;
5002
5012
  getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): ModeAwareCache<T>;
5003
5013
  clear(): void;
5004
5014
  /**
@@ -5015,7 +5025,8 @@ declare namespace ts {
5015
5025
  * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
5016
5026
  */
5017
5027
  export interface NonRelativeModuleNameResolutionCache extends PackageJsonInfoCache {
5018
- getOrCreateCacheForModuleName(nonRelativeModuleName: string, mode: ModuleKind.CommonJS | ModuleKind.ESNext | undefined, redirectedReference?: ResolvedProjectReference): PerModuleNameCache;
5028
+ getFromModuleNameCache(directory: string, nonRelativeModuleName: string, mode: ResolutionMode, redirectedReference: ResolvedProjectReference | undefined): ResolvedModuleWithFailedLookupLocations | undefined;
5029
+ getOrCreateCacheForModuleName(nonRelativeModuleName: string, mode: ResolutionMode, redirectedReference?: ResolvedProjectReference): PerModuleNameCache;
5019
5030
  }
5020
5031
  export interface PackageJsonInfoCache {
5021
5032
  clear(): void;
@@ -5026,8 +5037,8 @@ declare namespace ts {
5026
5037
  }
5027
5038
  export function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
5028
5039
  export function createTypeReferenceDirectiveResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions, packageJsonInfoCache?: PackageJsonInfoCache): TypeReferenceDirectiveResolutionCache;
5029
- export function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined;
5030
- export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations;
5040
+ export function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache, mode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
5041
+ export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations;
5031
5042
  export function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
5032
5043
  export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
5033
5044
  export {};
@@ -5141,7 +5152,7 @@ declare namespace ts {
5141
5152
  * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
5142
5153
  * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
5143
5154
  */
5144
- export function getModeForFileReference(ref: FileReference | string, containingFileMode: SourceFile["impliedNodeFormat"]): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
5155
+ export function getModeForFileReference(ref: FileReference | string, containingFileMode: ResolutionMode): ResolutionMode;
5145
5156
  /**
5146
5157
  * Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly
5147
5158
  * defined mode of the import if provided, or, if not, the mode of the containing file (with some exceptions: import=require is always commonjs, dynamic import is always esm).
@@ -5149,7 +5160,7 @@ declare namespace ts {
5149
5160
  * @param file File to fetch the resolution mode within
5150
5161
  * @param index Index into the file's complete resolution list to get the resolution of - this is a concatenation of the file's imports and module augmentations
5151
5162
  */
5152
- export function getModeForResolutionAtIndex(file: SourceFile, index: number): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
5163
+ export function getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
5153
5164
  /**
5154
5165
  * Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
5155
5166
  * one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
@@ -5160,7 +5171,7 @@ declare namespace ts {
5160
5171
  * @returns The final resolution mode of the import
5161
5172
  */
5162
5173
  export function getModeForUsageLocation(file: {
5163
- impliedNodeFormat?: SourceFile["impliedNodeFormat"];
5174
+ impliedNodeFormat?: ResolutionMode;
5164
5175
  }, usage: StringLiteralLike): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
5165
5176
  export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
5166
5177
  /**
@@ -5173,7 +5184,7 @@ declare namespace ts {
5173
5184
  * @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
5174
5185
  * @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
5175
5186
  */
5176
- export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ModuleKind.ESNext | ModuleKind.CommonJS | undefined;
5187
+ export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode;
5177
5188
  /**
5178
5189
  * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
5179
5190
  * that represent a compilation unit.
@@ -5228,10 +5239,6 @@ declare namespace ts {
5228
5239
  affected: SourceFile | Program;
5229
5240
  } | undefined;
5230
5241
  interface BuilderProgramHost {
5231
- /**
5232
- * return true if file names are treated with case sensitivity
5233
- */
5234
- useCaseSensitiveFileNames(): boolean;
5235
5242
  /**
5236
5243
  * If provided this would be used this hash instead of actual file shape text for detecting changes
5237
5244
  */
@@ -5418,9 +5425,9 @@ declare namespace ts {
5418
5425
  /** If provided is used to get the environment variable */
5419
5426
  getEnvironmentVariable?(name: string): string | undefined;
5420
5427
  /** If provided, used to resolve the module names, otherwise typescript's default module resolution */
5421
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
5428
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, partialResolutionInfo?: PartialResolutionInfo): ResolvedModuleWithFailedLookupLocations[] | (ResolvedModule | undefined)[];
5422
5429
  /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
5423
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
5430
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode, partialResolutionInfo?: PartialResolutionInfo): ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] | (ResolvedTypeReferenceDirective | undefined)[];
5424
5431
  /**
5425
5432
  * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
5426
5433
  */
@@ -5432,7 +5439,7 @@ declare namespace ts {
5432
5439
  /** If provided, use this method to get parsed command lines for referenced projects */
5433
5440
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
5434
5441
  /** If provided, callback to invoke after every new program creation */
5435
- afterProgramCreate?(program: T): void;
5442
+ afterProgramCreate?(program: T, host?: CompilerHost): void;
5436
5443
  }
5437
5444
  /**
5438
5445
  * Host to create watch with root files and options
@@ -5500,6 +5507,7 @@ declare namespace ts {
5500
5507
  force?: boolean;
5501
5508
  verbose?: boolean;
5502
5509
  incremental?: boolean;
5510
+ cacheResolutions?: boolean;
5503
5511
  assumeChangesOnlyAffectDirectDependencies?: boolean;
5504
5512
  traceResolution?: boolean;
5505
5513
  [option: string]: CompilerOptionsValue | undefined;
@@ -5523,7 +5531,7 @@ declare namespace ts {
5523
5531
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
5524
5532
  reportDiagnostic: DiagnosticReporter;
5525
5533
  reportSolutionBuilderStatus: DiagnosticReporter;
5526
- afterProgramEmitAndDiagnostics?(program: T): void;
5534
+ afterProgramEmitAndDiagnostics?(program: T, host?: CompilerHost): void;
5527
5535
  }
5528
5536
  interface SolutionBuilderHost<T extends BuilderProgram> extends SolutionBuilderHostBase<T> {
5529
5537
  reportErrorSummary?: ReportEmitErrorSummary;
@@ -5818,9 +5826,8 @@ declare namespace ts {
5818
5826
  readFile(path: string, encoding?: string): string | undefined;
5819
5827
  fileExists(path: string): boolean;
5820
5828
  getTypeRootsVersion?(): number;
5821
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
5822
- getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined;
5823
- resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
5829
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, partialResolutionInfo?: PartialResolutionInfo): ResolvedModuleWithFailedLookupLocations[] | (ResolvedModule | undefined)[];
5830
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode, partialResolutionInfo?: PartialResolutionInfo): ResolvedTypeReferenceDirectiveWithFailedLookupLocations[] | (ResolvedTypeReferenceDirective | undefined)[];
5824
5831
  getDirectories?(directoryName: string): string[];
5825
5832
  /**
5826
5833
  * Gets a set of custom transformers to use during emit.
@@ -6947,11 +6954,11 @@ declare namespace ts {
6947
6954
  * @param scriptKind The script kind of the file to be released
6948
6955
  * @param impliedNodeFormat The implied source file format of the file to be released
6949
6956
  */
6950
- releaseDocument(fileName: string, compilationSettings: CompilerOptions, scriptKind: ScriptKind, impliedNodeFormat: SourceFile["impliedNodeFormat"]): void;
6957
+ releaseDocument(fileName: string, compilationSettings: CompilerOptions, scriptKind: ScriptKind, impliedNodeFormat: ResolutionMode): void;
6951
6958
  /**
6952
6959
  * @deprecated pass scriptKind for and impliedNodeFormat correctness */
6953
6960
  releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey, scriptKind?: ScriptKind): void;
6954
- releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey, scriptKind: ScriptKind, impliedNodeFormat: SourceFile["impliedNodeFormat"]): void;
6961
+ releaseDocumentWithKey(path: Path, key: DocumentRegistryBucketKey, scriptKind: ScriptKind, impliedNodeFormat: ResolutionMode): void;
6955
6962
  reportStats(): string;
6956
6963
  }
6957
6964
  type DocumentRegistryBucketKey = string & {