typescript 4.7.1-rc → 4.7.4

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.
@@ -4720,6 +4720,7 @@ declare namespace ts {
4720
4720
  function isImportEqualsDeclaration(node: Node): node is ImportEqualsDeclaration;
4721
4721
  function isImportDeclaration(node: Node): node is ImportDeclaration;
4722
4722
  function isImportClause(node: Node): node is ImportClause;
4723
+ function isImportTypeAssertionContainer(node: Node): node is ImportTypeAssertionContainer;
4723
4724
  function isAssertClause(node: Node): node is AssertClause;
4724
4725
  function isAssertEntry(node: Node): node is AssertEntry;
4725
4726
  function isNamespaceImport(node: Node): node is NamespaceImport;
@@ -5098,6 +5099,31 @@ declare namespace ts {
5098
5099
  export function formatDiagnostic(diagnostic: Diagnostic, host: FormatDiagnosticsHost): string;
5099
5100
  export function formatDiagnosticsWithColorAndContext(diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string;
5100
5101
  export function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string;
5102
+ /**
5103
+ * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
5104
+ * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
5105
+ */
5106
+ export function getModeForFileReference(ref: FileReference | string, containingFileMode: SourceFile["impliedNodeFormat"]): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
5107
+ /**
5108
+ * Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly
5109
+ * 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).
5110
+ * If you have an actual import node, prefer using getModeForUsageLocation on the reference string node.
5111
+ * @param file File to fetch the resolution mode within
5112
+ * @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
5113
+ */
5114
+ export function getModeForResolutionAtIndex(file: SourceFile, index: number): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
5115
+ /**
5116
+ * Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
5117
+ * one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
5118
+ * Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
5119
+ * `moduleResolution` is `node16`+.
5120
+ * @param file The file the import or import-like reference is contained within
5121
+ * @param usage The module reference string
5122
+ * @returns The final resolution mode of the import
5123
+ */
5124
+ export function getModeForUsageLocation(file: {
5125
+ impliedNodeFormat?: SourceFile["impliedNodeFormat"];
5126
+ }, usage: StringLiteralLike): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
5101
5127
  export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
5102
5128
  /**
5103
5129
  * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the