typescript 5.0.0-dev.20221205 → 5.0.0-dev.20221207

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.
@@ -3382,14 +3382,7 @@ declare namespace ts {
3382
3382
  }
3383
3383
  interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
3384
3384
  readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined;
3385
- readonly failedLookupLocations: string[];
3386
3385
  }
3387
- interface ResolutionInfo<T> {
3388
- names: readonly T[];
3389
- reusedNames: readonly T[] | undefined;
3390
- }
3391
- type ModuleResolutionInfo = ResolutionInfo<StringLiteralLike>;
3392
- type TypeReferenceDirectiveResolutionInfo = ResolutionInfo<string | FileReference>;
3393
3386
  interface CompilerHost extends ModuleResolutionHost {
3394
3387
  getSourceFile(fileName: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3395
3388
  getSourceFileByPath?(fileName: string, path: Path, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
@@ -3402,15 +3395,20 @@ declare namespace ts {
3402
3395
  useCaseSensitiveFileNames(): boolean;
3403
3396
  getNewLine(): string;
3404
3397
  readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[];
3405
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModule | undefined)[];
3398
+ /** @deprecated supply resolveModuleNameLiterals instead for resolution that can handle newer resolution modes like nodenext */
3399
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
3406
3400
  /**
3407
3401
  * 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
3408
3402
  */
3409
3403
  getModuleResolutionCache?(): ModuleResolutionCache | undefined;
3410
3404
  /**
3405
+ * @deprecated supply resolveTypeReferenceDirectiveReferences instead for resolution that can handle newer resolution modes like nodenext
3406
+ *
3411
3407
  * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
3412
3408
  */
3413
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode | undefined, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
3409
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode): (ResolvedTypeReferenceDirective | undefined)[];
3410
+ resolveModuleNameLiterals?(moduleLiterals: readonly StringLiteralLike[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile, reusedNames: readonly StringLiteralLike[] | undefined): readonly ResolvedModuleWithFailedLookupLocations[];
3411
+ resolveTypeReferenceDirectiveReferences?<T extends FileReference | string>(typeDirectiveReferences: readonly T[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile | undefined, reusedNames: readonly T[] | undefined): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[];
3414
3412
  getEnvironmentVariable?(name: string): string | undefined;
3415
3413
  /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
3416
3414
  hasInvalidatedResolutions?(filePath: Path): boolean;
@@ -5256,7 +5254,7 @@ declare namespace ts {
5256
5254
  function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations;
5257
5255
  function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
5258
5256
  function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
5259
- interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
5257
+ interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, NonRelativeNameResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
5260
5258
  }
5261
5259
  interface ModeAwareCache<T> {
5262
5260
  get(key: string, mode: ResolutionMode): T | undefined;
@@ -5271,6 +5269,7 @@ declare namespace ts {
5271
5269
  * This assumes that any module id will have the same resolution for sibling files located in the same folder.
5272
5270
  */
5273
5271
  interface PerDirectoryResolutionCache<T> {
5272
+ getFromDirectoryCache(name: string, mode: ResolutionMode, directoryName: string, redirectedReference: ResolvedProjectReference | undefined): T | undefined;
5274
5273
  getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): ModeAwareCache<T>;
5275
5274
  clear(): void;
5276
5275
  /**
@@ -5279,6 +5278,20 @@ declare namespace ts {
5279
5278
  */
5280
5279
  update(options: CompilerOptions): void;
5281
5280
  }
5281
+ interface NonRelativeNameResolutionCache<T> {
5282
+ getFromNonRelativeNameCache(nonRelativeName: string, mode: ResolutionMode, directoryName: string, redirectedReference: ResolvedProjectReference | undefined): T | undefined;
5283
+ getOrCreateCacheForNonRelativeName(nonRelativeName: string, mode: ResolutionMode, redirectedReference?: ResolvedProjectReference): PerNonRelativeNameCache<T>;
5284
+ clear(): void;
5285
+ /**
5286
+ * Updates with the current compilerOptions the cache will operate with.
5287
+ * This updates the redirects map as well if needed so module resolutions are cached if they can across the projects
5288
+ */
5289
+ update(options: CompilerOptions): void;
5290
+ }
5291
+ interface PerNonRelativeNameCache<T> {
5292
+ get(directory: string): T | undefined;
5293
+ set(directory: string, result: T): void;
5294
+ }
5282
5295
  interface ModuleResolutionCache extends PerDirectoryResolutionCache<ResolvedModuleWithFailedLookupLocations>, NonRelativeModuleNameResolutionCache, PackageJsonInfoCache {
5283
5296
  getPackageJsonInfoCache(): PackageJsonInfoCache;
5284
5297
  }
@@ -5286,16 +5299,14 @@ declare namespace ts {
5286
5299
  * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
5287
5300
  * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
5288
5301
  */
5289
- interface NonRelativeModuleNameResolutionCache extends PackageJsonInfoCache {
5302
+ interface NonRelativeModuleNameResolutionCache extends NonRelativeNameResolutionCache<ResolvedModuleWithFailedLookupLocations>, PackageJsonInfoCache {
5303
+ /** @deprecated Use getOrCreateCacheForNonRelativeName */
5290
5304
  getOrCreateCacheForModuleName(nonRelativeModuleName: string, mode: ResolutionMode, redirectedReference?: ResolvedProjectReference): PerModuleNameCache;
5291
5305
  }
5292
5306
  interface PackageJsonInfoCache {
5293
5307
  clear(): void;
5294
5308
  }
5295
- interface PerModuleNameCache {
5296
- get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined;
5297
- set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
5298
- }
5309
+ type PerModuleNameCache = PerNonRelativeNameCache<ResolvedModuleWithFailedLookupLocations>;
5299
5310
  /**
5300
5311
  * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
5301
5312
  *
@@ -5678,10 +5689,20 @@ declare namespace ts {
5678
5689
  trace?(s: string): void;
5679
5690
  /** If provided is used to get the environment variable */
5680
5691
  getEnvironmentVariable?(name: string): string | undefined;
5681
- /** If provided, used to resolve the module names, otherwise typescript's default module resolution */
5682
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModule | undefined)[];
5683
- /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
5684
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
5692
+ /**
5693
+ * @deprecated supply resolveModuleNameLiterals instead for resolution that can handle newer resolution modes like nodenext
5694
+ *
5695
+ * If provided, used to resolve the module names, otherwise typescript's default module resolution
5696
+ */
5697
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
5698
+ /**
5699
+ * @deprecated supply resolveTypeReferenceDirectiveReferences instead for resolution that can handle newer resolution modes like nodenext
5700
+ *
5701
+ * If provided, used to resolve type reference directives, otherwise typescript's default resolution
5702
+ */
5703
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode): (ResolvedTypeReferenceDirective | undefined)[];
5704
+ resolveModuleNameLiterals?(moduleLiterals: readonly StringLiteralLike[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile, reusedNames: readonly StringLiteralLike[] | undefined): readonly ResolvedModuleWithFailedLookupLocations[];
5705
+ resolveTypeReferenceDirectiveReferences?<T extends FileReference | string>(typeDirectiveReferences: readonly T[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile | undefined, reusedNames: readonly T[] | undefined): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[];
5685
5706
  /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
5686
5707
  hasInvalidatedResolutions?(filePath: Path): boolean;
5687
5708
  /**
@@ -5986,9 +6007,13 @@ declare namespace ts {
5986
6007
  readFile(path: string, encoding?: string): string | undefined;
5987
6008
  fileExists(path: string): boolean;
5988
6009
  getTypeRootsVersion?(): number;
5989
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModule | undefined)[];
6010
+ /** @deprecated supply resolveModuleNameLiterals instead for resolution that can handle newer resolution modes like nodenext */
6011
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
5990
6012
  getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
5991
- resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
6013
+ /** @deprecated supply resolveTypeReferenceDirectiveReferences instead for resolution that can handle newer resolution modes like nodenext */
6014
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode): (ResolvedTypeReferenceDirective | undefined)[];
6015
+ resolveModuleNameLiterals?(moduleLiterals: readonly StringLiteralLike[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile, reusedNames: readonly StringLiteralLike[] | undefined): readonly ResolvedModuleWithFailedLookupLocations[];
6016
+ resolveTypeReferenceDirectiveReferences?<T extends FileReference | string>(typeDirectiveReferences: readonly T[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile | undefined, reusedNames: readonly T[] | undefined): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[];
5992
6017
  getDirectories?(directoryName: string): string[];
5993
6018
  /**
5994
6019
  * Gets a set of custom transformers to use during emit.