@typescript-deploys/pr-build 4.7.0-pr-48080-37 → 4.7.0-pr-47657-5

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.
@@ -424,6 +424,7 @@ declare namespace ts {
424
424
  JSDocFunctionType = 316,
425
425
  JSDocVariadicType = 317,
426
426
  JSDocNamepathType = 318,
427
+ /** @deprecated Use SyntaxKind.JSDoc */
427
428
  JSDocComment = 319,
428
429
  JSDocText = 320,
429
430
  JSDocTypeLiteral = 321,
@@ -491,6 +492,7 @@ declare namespace ts {
491
492
  LastJSDocNode = 346,
492
493
  FirstJSDocTagNode = 326,
493
494
  LastJSDocTagNode = 346,
495
+ JSDoc = 319
494
496
  }
495
497
  export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
496
498
  export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
@@ -1820,7 +1822,7 @@ declare namespace ts {
1820
1822
  }
1821
1823
  export type JSDocTypeReferencingNode = JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
1822
1824
  export interface JSDoc extends Node {
1823
- readonly kind: SyntaxKind.JSDocComment;
1825
+ readonly kind: SyntaxKind.JSDoc;
1824
1826
  readonly parent: HasJSDoc;
1825
1827
  readonly tags?: NodeArray<JSDocTag>;
1826
1828
  readonly comment?: string | NodeArray<JSDocComment>;
@@ -2668,13 +2670,14 @@ declare namespace ts {
2668
2670
  ObjectLiteralPatternWithComputedProperties = 512,
2669
2671
  ReverseMapped = 1024,
2670
2672
  JsxAttributes = 2048,
2671
- JSLiteral = 4096,
2672
- FreshLiteral = 8192,
2673
- ArrayLiteral = 16384,
2673
+ MarkerType = 4096,
2674
+ JSLiteral = 8192,
2675
+ FreshLiteral = 16384,
2676
+ ArrayLiteral = 32768,
2674
2677
  ClassOrInterface = 3,
2675
- ContainsSpread = 2097152,
2676
- ObjectRestType = 4194304,
2677
- InstantiationExpressionType = 8388608,
2678
+ ContainsSpread = 4194304,
2679
+ ObjectRestType = 8388608,
2680
+ InstantiationExpressionType = 16777216,
2678
2681
  }
2679
2682
  export interface ObjectType extends Type {
2680
2683
  objectFlags: ObjectFlags;
@@ -2885,6 +2888,20 @@ declare namespace ts {
2885
2888
  Node12 = 3,
2886
2889
  NodeNext = 99
2887
2890
  }
2891
+ export enum ModuleDetectionKind {
2892
+ /**
2893
+ * Files with imports, exports and/or import.meta are considered modules
2894
+ */
2895
+ Legacy = 1,
2896
+ /**
2897
+ * Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node12+
2898
+ */
2899
+ Auto = 2,
2900
+ /**
2901
+ * Consider all non-declaration files modules, regardless of present syntax
2902
+ */
2903
+ Force = 3
2904
+ }
2888
2905
  export interface PluginImport {
2889
2906
  name: string;
2890
2907
  }
@@ -2956,6 +2973,7 @@ declare namespace ts {
2956
2973
  maxNodeModuleJsDepth?: number;
2957
2974
  module?: ModuleKind;
2958
2975
  moduleResolution?: ModuleResolutionKind;
2976
+ moduleDetection?: ModuleDetectionKind;
2959
2977
  newLine?: NewLineKind;
2960
2978
  noEmit?: boolean;
2961
2979
  noEmitHelpers?: boolean;
@@ -3143,6 +3161,13 @@ declare namespace ts {
3143
3161
  getDirectories?(path: string): string[];
3144
3162
  useCaseSensitiveFileNames?: boolean | (() => boolean);
3145
3163
  }
3164
+ /**
3165
+ * Used by services to specify the minimum host area required to set up source files under any compilation settings
3166
+ */
3167
+ export interface MinimalResolutionCacheHost extends ModuleResolutionHost {
3168
+ getCompilationSettings(): CompilerOptions;
3169
+ getCompilerHost?(): CompilerHost | undefined;
3170
+ }
3146
3171
  /**
3147
3172
  * Represents the result of module resolution.
3148
3173
  * Module resolution will pick up tsx/jsx/js files even if '--jsx' and '--allowJs' are turned off.
@@ -3218,8 +3243,8 @@ declare namespace ts {
3218
3243
  readonly failedLookupLocations: string[];
3219
3244
  }
3220
3245
  export interface CompilerHost extends ModuleResolutionHost {
3221
- getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3222
- getSourceFileByPath?(fileName: string, path: Path, languageVersion: ScriptTarget, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3246
+ getSourceFile(fileName: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3247
+ getSourceFileByPath?(fileName: string, path: Path, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, onError?: (message: string) => void, shouldCreateNewSourceFile?: boolean): SourceFile | undefined;
3223
3248
  getCancellationToken?(): CancellationToken;
3224
3249
  getDefaultLibFileName(options: CompilerOptions): string;
3225
3250
  getDefaultLibLocation?(): string;
@@ -4773,7 +4798,22 @@ declare namespace ts {
4773
4798
  * that they appear in the source code. The language service depends on this property to locate nodes by position.
4774
4799
  */
4775
4800
  export function forEachChild<T>(node: Node, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined): T | undefined;
4776
- export function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
4801
+ export interface CreateSourceFileOptions {
4802
+ languageVersion: ScriptTarget;
4803
+ /**
4804
+ * Controls the format the file is detected as - this can be derived from only the path
4805
+ * and files on disk, but needs to be done with a module resolution cache in scope to be performant.
4806
+ * This is usually `undefined` for compilations that do not have `moduleResolution` values of `node12` or `nodenext`.
4807
+ */
4808
+ impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS;
4809
+ /**
4810
+ * Controls how module-y-ness is set for the given file. Usually the result of calling
4811
+ * `getSetExternalModuleIndicator` on a valid `CompilerOptions` object. If not present, the default
4812
+ * check specified by `isFileProbablyExternalModule` will be used to set the field.
4813
+ */
4814
+ setExternalModuleIndicator?: (file: SourceFile) => void;
4815
+ }
4816
+ export function createSourceFile(fileName: string, sourceText: string, languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions, setParentNodes?: boolean, scriptKind?: ScriptKind): SourceFile;
4777
4817
  export function parseIsolatedEntityName(text: string, languageVersion: ScriptTarget): EntityName | undefined;
4778
4818
  /**
4779
4819
  * Parse json text into SyntaxTree and return node and parse errors if any
@@ -5673,7 +5713,7 @@ declare namespace ts {
5673
5713
  set(response: CompletionInfo): void;
5674
5714
  clear(): void;
5675
5715
  }
5676
- interface LanguageServiceHost extends GetEffectiveTypeRootsHost {
5716
+ interface LanguageServiceHost extends GetEffectiveTypeRootsHost, MinimalResolutionCacheHost {
5677
5717
  getCompilationSettings(): CompilerOptions;
5678
5718
  getNewLine?(): string;
5679
5719
  getProjectVersion?(): string;
@@ -5691,9 +5731,9 @@ declare namespace ts {
5691
5731
  error?(s: string): void;
5692
5732
  useCaseSensitiveFileNames?(): boolean;
5693
5733
  readDirectory?(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
5694
- readFile?(path: string, encoding?: string): string | undefined;
5695
5734
  realpath?(path: string): string;
5696
- fileExists?(path: string): boolean;
5735
+ readFile(path: string, encoding?: string): string | undefined;
5736
+ fileExists(path: string): boolean;
5697
5737
  getTypeRootsVersion?(): number;
5698
5738
  resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
5699
5739
  getResolvedModuleWithFailedLookupLocationsFromCache?(modulename: string, containingFile: string, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations | undefined;
@@ -6745,30 +6785,36 @@ declare namespace ts {
6745
6785
  * the SourceFile if was not found in the registry.
6746
6786
  *
6747
6787
  * @param fileName The name of the file requested
6748
- * @param compilationSettings Some compilation settings like target affects the
6788
+ * @param compilationSettingsOrHost Some compilation settings like target affects the
6749
6789
  * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
6750
- * multiple copies of the same file for different compilation settings.
6790
+ * multiple copies of the same file for different compilation settings. A minimal
6791
+ * resolution cache is needed to fully define a source file's shape when
6792
+ * the compilation settings include `module: node12`+, so providing a cache host
6793
+ * object should be preferred. A common host is a language service `ConfiguredProject`.
6751
6794
  * @param scriptSnapshot Text of the file. Only used if the file was not found
6752
6795
  * in the registry and a new one was created.
6753
6796
  * @param version Current version of the file. Only used if the file was not found
6754
6797
  * in the registry and a new one was created.
6755
6798
  */
6756
- acquireDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6757
- acquireDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6799
+ acquireDocument(fileName: string, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6800
+ acquireDocumentWithKey(fileName: string, path: Path, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6758
6801
  /**
6759
6802
  * Request an updated version of an already existing SourceFile with a given fileName
6760
6803
  * and compilationSettings. The update will in-turn call updateLanguageServiceSourceFile
6761
6804
  * to get an updated SourceFile.
6762
6805
  *
6763
6806
  * @param fileName The name of the file requested
6764
- * @param compilationSettings Some compilation settings like target affects the
6807
+ * @param compilationSettingsOrHost Some compilation settings like target affects the
6765
6808
  * shape of a the resulting SourceFile. This allows the DocumentRegistry to store
6766
- * multiple copies of the same file for different compilation settings.
6809
+ * multiple copies of the same file for different compilation settings. A minimal
6810
+ * resolution cache is needed to fully define a source file's shape when
6811
+ * the compilation settings include `module: node12`+, so providing a cache host
6812
+ * object should be preferred. A common host is a language service `ConfiguredProject`.
6767
6813
  * @param scriptSnapshot Text of the file.
6768
6814
  * @param version Current version of the file.
6769
6815
  */
6770
- updateDocument(fileName: string, compilationSettings: CompilerOptions, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6771
- updateDocumentWithKey(fileName: string, path: Path, compilationSettings: CompilerOptions, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6816
+ updateDocument(fileName: string, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6817
+ updateDocumentWithKey(fileName: string, path: Path, compilationSettingsOrHost: CompilerOptions | MinimalResolutionCacheHost, key: DocumentRegistryBucketKey, scriptSnapshot: IScriptSnapshot, version: string, scriptKind?: ScriptKind): SourceFile;
6772
6818
  getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey;
6773
6819
  /**
6774
6820
  * Informs the DocumentRegistry that a file is not needed any longer.
@@ -6830,7 +6876,7 @@ declare namespace ts {
6830
6876
  function displayPartsToString(displayParts: SymbolDisplayPart[] | undefined): string;
6831
6877
  function getDefaultCompilerOptions(): CompilerOptions;
6832
6878
  function getSupportedCodeFixes(): string[];
6833
- function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
6879
+ function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTargetOrOptions: ScriptTarget | CreateSourceFileOptions, version: string, setNodeParents: boolean, scriptKind?: ScriptKind): SourceFile;
6834
6880
  function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange | undefined, aggressiveChecks?: boolean): SourceFile;
6835
6881
  function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry, syntaxOnlyOrLanguageServiceMode?: boolean | LanguageServiceMode): LanguageService;
6836
6882
  /**