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.
@@ -3183,10 +3183,7 @@ declare namespace ts {
3183
3183
  readFile(fileName: string): string | undefined;
3184
3184
  writeFile(fileName: string, content: string): void;
3185
3185
  fileExists(file: string): boolean;
3186
- resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames?: string[], redirectedReference?: ResolvedProjectReference, _options?: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModuleFull | undefined)[];
3187
3186
  getModuleResolutionCache(): ModuleResolutionCache | undefined;
3188
- getResolvedModuleWithFailedLookupLocationsFromCache(moduleName: string, containingFile: string, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
3189
- resolveTypeReferenceDirectives(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference?: ResolvedProjectReference, _options?: CompilerOptions, containingFileMode?: ResolutionMode, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
3190
3187
  directoryExists(path: string): boolean;
3191
3188
  getDirectories(path: string): string[];
3192
3189
  log(s: string): void;
@@ -7318,14 +7315,7 @@ declare namespace ts {
7318
7315
  }
7319
7316
  interface ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
7320
7317
  readonly resolvedTypeReferenceDirective: ResolvedTypeReferenceDirective | undefined;
7321
- readonly failedLookupLocations: string[];
7322
7318
  }
7323
- interface ResolutionInfo<T> {
7324
- names: readonly T[];
7325
- reusedNames: readonly T[] | undefined;
7326
- }
7327
- type ModuleResolutionInfo = ResolutionInfo<StringLiteralLike>;
7328
- type TypeReferenceDirectiveResolutionInfo = ResolutionInfo<string | FileReference>;
7329
7319
  interface CompilerHost extends ModuleResolutionHost {
7330
7320
  getSourceFile(fileName: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
7331
7321
  getSourceFileByPath?(fileName: string, path: Path, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
@@ -7338,15 +7328,20 @@ declare namespace ts {
7338
7328
  useCaseSensitiveFileNames(): boolean;
7339
7329
  getNewLine(): string;
7340
7330
  readDirectory?(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number): string[];
7341
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModule | undefined)[];
7331
+ /** @deprecated supply resolveModuleNameLiterals instead for resolution that can handle newer resolution modes like nodenext */
7332
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
7342
7333
  /**
7343
7334
  * 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
7344
7335
  */
7345
7336
  getModuleResolutionCache?(): ModuleResolutionCache | undefined;
7346
7337
  /**
7338
+ * @deprecated supply resolveTypeReferenceDirectiveReferences instead for resolution that can handle newer resolution modes like nodenext
7339
+ *
7347
7340
  * This method is a companion for 'resolveModuleNames' and is used to resolve 'types' references to actual type declaration files
7348
7341
  */
7349
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode | undefined, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
7342
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode): (ResolvedTypeReferenceDirective | undefined)[];
7343
+ resolveModuleNameLiterals?(moduleLiterals: readonly StringLiteralLike[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile, reusedNames: readonly StringLiteralLike[] | undefined): readonly ResolvedModuleWithFailedLookupLocations[];
7344
+ resolveTypeReferenceDirectiveReferences?<T extends FileReference | string>(typeDirectiveReferences: readonly T[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile | undefined, reusedNames: readonly T[] | undefined): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[];
7350
7345
  getEnvironmentVariable?(name: string): string | undefined;
7351
7346
  /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
7352
7347
  hasInvalidatedResolutions?(filePath: Path): boolean;
@@ -9192,7 +9187,7 @@ declare namespace ts {
9192
9187
  function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations;
9193
9188
  function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
9194
9189
  function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: NonRelativeModuleNameResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
9195
- interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
9190
+ interface TypeReferenceDirectiveResolutionCache extends PerDirectoryResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, NonRelativeNameResolutionCache<ResolvedTypeReferenceDirectiveWithFailedLookupLocations>, PackageJsonInfoCache {
9196
9191
  }
9197
9192
  interface ModeAwareCache<T> {
9198
9193
  get(key: string, mode: ResolutionMode): T | undefined;
@@ -9207,6 +9202,7 @@ declare namespace ts {
9207
9202
  * This assumes that any module id will have the same resolution for sibling files located in the same folder.
9208
9203
  */
9209
9204
  interface PerDirectoryResolutionCache<T> {
9205
+ getFromDirectoryCache(name: string, mode: ResolutionMode, directoryName: string, redirectedReference: ResolvedProjectReference | undefined): T | undefined;
9210
9206
  getOrCreateCacheForDirectory(directoryName: string, redirectedReference?: ResolvedProjectReference): ModeAwareCache<T>;
9211
9207
  clear(): void;
9212
9208
  /**
@@ -9215,6 +9211,20 @@ declare namespace ts {
9215
9211
  */
9216
9212
  update(options: CompilerOptions): void;
9217
9213
  }
9214
+ interface NonRelativeNameResolutionCache<T> {
9215
+ getFromNonRelativeNameCache(nonRelativeName: string, mode: ResolutionMode, directoryName: string, redirectedReference: ResolvedProjectReference | undefined): T | undefined;
9216
+ getOrCreateCacheForNonRelativeName(nonRelativeName: string, mode: ResolutionMode, redirectedReference?: ResolvedProjectReference): PerNonRelativeNameCache<T>;
9217
+ clear(): void;
9218
+ /**
9219
+ * Updates with the current compilerOptions the cache will operate with.
9220
+ * This updates the redirects map as well if needed so module resolutions are cached if they can across the projects
9221
+ */
9222
+ update(options: CompilerOptions): void;
9223
+ }
9224
+ interface PerNonRelativeNameCache<T> {
9225
+ get(directory: string): T | undefined;
9226
+ set(directory: string, result: T): void;
9227
+ }
9218
9228
  interface ModuleResolutionCache extends PerDirectoryResolutionCache<ResolvedModuleWithFailedLookupLocations>, NonRelativeModuleNameResolutionCache, PackageJsonInfoCache {
9219
9229
  getPackageJsonInfoCache(): PackageJsonInfoCache;
9220
9230
  }
@@ -9222,16 +9232,14 @@ declare namespace ts {
9222
9232
  * Stored map from non-relative module name to a table: directory -> result of module lookup in this directory
9223
9233
  * We support only non-relative module names because resolution of relative module names is usually more deterministic and thus less expensive.
9224
9234
  */
9225
- interface NonRelativeModuleNameResolutionCache extends PackageJsonInfoCache {
9235
+ interface NonRelativeModuleNameResolutionCache extends NonRelativeNameResolutionCache<ResolvedModuleWithFailedLookupLocations>, PackageJsonInfoCache {
9236
+ /** @deprecated Use getOrCreateCacheForNonRelativeName */
9226
9237
  getOrCreateCacheForModuleName(nonRelativeModuleName: string, mode: ResolutionMode, redirectedReference?: ResolvedProjectReference): PerModuleNameCache;
9227
9238
  }
9228
9239
  interface PackageJsonInfoCache {
9229
9240
  clear(): void;
9230
9241
  }
9231
- interface PerModuleNameCache {
9232
- get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined;
9233
- set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
9234
- }
9242
+ type PerModuleNameCache = PerNonRelativeNameCache<ResolvedModuleWithFailedLookupLocations>;
9235
9243
  /**
9236
9244
  * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
9237
9245
  *
@@ -9614,10 +9622,20 @@ declare namespace ts {
9614
9622
  trace?(s: string): void;
9615
9623
  /** If provided is used to get the environment variable */
9616
9624
  getEnvironmentVariable?(name: string): string | undefined;
9617
- /** If provided, used to resolve the module names, otherwise typescript's default module resolution */
9618
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModule | undefined)[];
9619
- /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
9620
- resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
9625
+ /**
9626
+ * @deprecated supply resolveModuleNameLiterals instead for resolution that can handle newer resolution modes like nodenext
9627
+ *
9628
+ * If provided, used to resolve the module names, otherwise typescript's default module resolution
9629
+ */
9630
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
9631
+ /**
9632
+ * @deprecated supply resolveTypeReferenceDirectiveReferences instead for resolution that can handle newer resolution modes like nodenext
9633
+ *
9634
+ * If provided, used to resolve type reference directives, otherwise typescript's default resolution
9635
+ */
9636
+ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode): (ResolvedTypeReferenceDirective | undefined)[];
9637
+ resolveModuleNameLiterals?(moduleLiterals: readonly StringLiteralLike[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile, reusedNames: readonly StringLiteralLike[] | undefined): readonly ResolvedModuleWithFailedLookupLocations[];
9638
+ resolveTypeReferenceDirectiveReferences?<T extends FileReference | string>(typeDirectiveReferences: readonly T[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile | undefined, reusedNames: readonly T[] | undefined): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[];
9621
9639
  /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
9622
9640
  hasInvalidatedResolutions?(filePath: Path): boolean;
9623
9641
  /**
@@ -9849,9 +9867,13 @@ declare namespace ts {
9849
9867
  readFile(path: string, encoding?: string): string | undefined;
9850
9868
  fileExists(path: string): boolean;
9851
9869
  getTypeRootsVersion?(): number;
9852
- resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile, resolutionInfo?: ModuleResolutionInfo): (ResolvedModule | undefined)[];
9870
+ /** @deprecated supply resolveModuleNameLiterals instead for resolution that can handle newer resolution modes like nodenext */
9871
+ resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
9853
9872
  getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string, resolutionMode?: ResolutionMode): ResolvedModuleWithFailedLookupLocations | undefined;
9854
- resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode, resolutionInfo?: TypeReferenceDirectiveResolutionInfo): (ResolvedTypeReferenceDirective | undefined)[];
9873
+ /** @deprecated supply resolveTypeReferenceDirectiveReferences instead for resolution that can handle newer resolution modes like nodenext */
9874
+ resolveTypeReferenceDirectives?(typeDirectiveNames: string[] | FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: ResolutionMode): (ResolvedTypeReferenceDirective | undefined)[];
9875
+ resolveModuleNameLiterals?(moduleLiterals: readonly StringLiteralLike[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile, reusedNames: readonly StringLiteralLike[] | undefined): readonly ResolvedModuleWithFailedLookupLocations[];
9876
+ resolveTypeReferenceDirectiveReferences?<T extends FileReference | string>(typeDirectiveReferences: readonly T[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile: SourceFile | undefined, reusedNames: readonly T[] | undefined): readonly ResolvedTypeReferenceDirectiveWithFailedLookupLocations[];
9855
9877
  getDirectories?(directoryName: string): string[];
9856
9878
  /**
9857
9879
  * Gets a set of custom transformers to use during emit.