@schematics/angular 17.2.3 → 17.3.0-rc.0

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.
@@ -49,9 +49,11 @@ declare namespace ts {
49
49
  readonly fileName: Path;
50
50
  readonly packageName: string;
51
51
  readonly projectRootPath: Path;
52
+ readonly id: number;
52
53
  }
53
54
  interface PackageInstalledResponse extends ProjectResponse {
54
55
  readonly kind: ActionPackageInstalled;
56
+ readonly id: number;
55
57
  readonly success: boolean;
56
58
  readonly message: string;
57
59
  }
@@ -203,7 +205,7 @@ declare namespace ts {
203
205
  /**
204
206
  * Request to reload the project structure for all the opened files
205
207
  */
206
- interface ReloadProjectsRequest extends Message {
208
+ interface ReloadProjectsRequest extends Request {
207
209
  command: CommandTypes.ReloadProjects;
208
210
  }
209
211
  /**
@@ -1085,6 +1087,7 @@ declare namespace ts {
1085
1087
  displayName: string;
1086
1088
  /**
1087
1089
  * Full display name of item to be renamed.
1090
+ * If item to be renamed is a file, then this is the original text of the module specifer
1088
1091
  */
1089
1092
  fullDisplayName: string;
1090
1093
  /**
@@ -2930,6 +2933,13 @@ declare namespace ts {
2930
2933
  * Default: `false`
2931
2934
  */
2932
2935
  readonly organizeImportsCaseFirst?: "upper" | "lower" | false;
2936
+ /**
2937
+ * Indicates where named type-only imports should sort. "inline" sorts named imports without regard to if the import is
2938
+ * type-only.
2939
+ *
2940
+ * Default: `last`
2941
+ */
2942
+ readonly organizeImportsTypeOrder?: "last" | "first" | "inline";
2933
2943
  /**
2934
2944
  * Indicates whether {@link ReferencesResponseItem.lineText} is supported.
2935
2945
  */
@@ -3026,10 +3036,18 @@ declare namespace ts {
3026
3036
  ES6 = "ES6",
3027
3037
  ES2015 = "ES2015",
3028
3038
  ESNext = "ESNext",
3039
+ Node16 = "Node16",
3040
+ NodeNext = "NodeNext",
3041
+ Preserve = "Preserve",
3029
3042
  }
3030
3043
  enum ModuleResolutionKind {
3031
3044
  Classic = "Classic",
3045
+ /** @deprecated Renamed to `Node10` */
3032
3046
  Node = "Node",
3047
+ Node10 = "Node10",
3048
+ Node16 = "Node16",
3049
+ NodeNext = "NodeNext",
3050
+ Bundler = "Bundler",
3033
3051
  }
3034
3052
  enum NewLineKind {
3035
3053
  Crlf = "Crlf",
@@ -3314,18 +3332,6 @@ declare namespace ts {
3314
3332
  * Last version that was reported.
3315
3333
  */
3316
3334
  private lastReportedVersion;
3317
- /**
3318
- * Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
3319
- * This property is changed in 'updateGraph' based on the set of files in program
3320
- */
3321
- private projectProgramVersion;
3322
- /**
3323
- * Current version of the project state. It is changed when:
3324
- * - new root file was added/removed
3325
- * - edit happen in some file that is currently included in the project.
3326
- * This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
3327
- */
3328
- private projectStateVersion;
3329
3335
  protected projectErrors: Diagnostic[] | undefined;
3330
3336
  protected isInitialLoadPending: () => boolean;
3331
3337
  private readonly cancellationToken;
@@ -3900,6 +3906,7 @@ declare namespace ts {
3900
3906
  private static escapeFilenameForRegex;
3901
3907
  resetSafeList(): void;
3902
3908
  applySafeList(proj: protocol.ExternalProject): NormalizedPath[];
3909
+ private applySafeListWorker;
3903
3910
  openExternalProject(proj: protocol.ExternalProject): void;
3904
3911
  hasDeferredExtension(): boolean;
3905
3912
  private enableRequestedPluginsAsync;
@@ -4132,7 +4139,7 @@ declare namespace ts {
4132
4139
  responseRequired?: boolean;
4133
4140
  }
4134
4141
  }
4135
- const versionMajorMinor = "5.3";
4142
+ const versionMajorMinor = "5.4";
4136
4143
  /** The version of the TypeScript compiler release */
4137
4144
  const version: string;
4138
4145
  /**
@@ -6018,9 +6025,11 @@ declare namespace ts {
6018
6025
  /** @deprecated */
6019
6026
  type AssertionKey = ImportAttributeName;
6020
6027
  /** @deprecated */
6021
- type AssertEntry = ImportAttribute;
6028
+ interface AssertEntry extends ImportAttribute {
6029
+ }
6022
6030
  /** @deprecated */
6023
- type AssertClause = ImportAttributes;
6031
+ interface AssertClause extends ImportAttributes {
6032
+ }
6024
6033
  type ImportAttributeName = Identifier | StringLiteral;
6025
6034
  interface ImportAttribute extends Node {
6026
6035
  readonly kind: SyntaxKind.ImportAttribute;
@@ -6648,6 +6657,22 @@ declare namespace ts {
6648
6657
  };
6649
6658
  isSourceFileFromExternalLibrary(file: SourceFile): boolean;
6650
6659
  isSourceFileDefaultLibrary(file: SourceFile): boolean;
6660
+ /**
6661
+ * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import
6662
+ * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may
6663
+ * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other
6664
+ * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no
6665
+ * impact on module resolution, emit, or type checking.
6666
+ */
6667
+ getModeForUsageLocation(file: SourceFile, usage: StringLiteralLike): ResolutionMode;
6668
+ /**
6669
+ * Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode
6670
+ * explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In
6671
+ * `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the
6672
+ * input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns
6673
+ * `undefined`, as the result would have no impact on module resolution, emit, or type checking.
6674
+ */
6675
+ getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
6651
6676
  getProjectReferences(): readonly ProjectReference[] | undefined;
6652
6677
  getResolvedProjectReferences(): readonly (ResolvedProjectReference | undefined)[] | undefined;
6653
6678
  }
@@ -6827,6 +6852,20 @@ declare namespace ts {
6827
6852
  * is `never`. Instead, use `type.flags & TypeFlags.Never`.
6828
6853
  */
6829
6854
  getNeverType(): Type;
6855
+ /**
6856
+ * Returns true if the "source" type is assignable to the "target" type.
6857
+ *
6858
+ * ```ts
6859
+ * declare const abcLiteral: ts.Type; // Type of "abc"
6860
+ * declare const stringType: ts.Type; // Type of string
6861
+ *
6862
+ * isTypeAssignableTo(abcLiteral, abcLiteral); // true; "abc" is assignable to "abc"
6863
+ * isTypeAssignableTo(abcLiteral, stringType); // true; "abc" is assignable to string
6864
+ * isTypeAssignableTo(stringType, abcLiteral); // false; string is not assignable to "abc"
6865
+ * isTypeAssignableTo(stringType, stringType); // true; string is assignable to string
6866
+ * ```
6867
+ */
6868
+ isTypeAssignableTo(source: Type, target: Type): boolean;
6830
6869
  /**
6831
6870
  * True if this type is the `Array` or `ReadonlyArray` type from lib.d.ts.
6832
6871
  * This function will _not_ return true if passed a type which
@@ -6842,6 +6881,7 @@ declare namespace ts {
6842
6881
  * True if this type is assignable to `ReadonlyArray<any>`.
6843
6882
  */
6844
6883
  isArrayLikeType(type: Type): boolean;
6884
+ resolveName(name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean): Symbol | undefined;
6845
6885
  getTypePredicateOfSignature(signature: Signature): TypePredicate | undefined;
6846
6886
  /**
6847
6887
  * Depending on the operation performed, it may be appropriate to throw away the checker
@@ -6887,6 +6927,7 @@ declare namespace ts {
6887
6927
  None = 0,
6888
6928
  NoTruncation = 1,
6889
6929
  WriteArrayAsGenericType = 2,
6930
+ GenerateNamesForShadowedTypeParams = 4,
6890
6931
  UseStructuralFallback = 8,
6891
6932
  WriteTypeArgumentsOfSignature = 32,
6892
6933
  UseFullyQualifiedType = 64,
@@ -6906,7 +6947,7 @@ declare namespace ts {
6906
6947
  InElementType = 2097152,
6907
6948
  InFirstTypeArgument = 4194304,
6908
6949
  InTypeAlias = 8388608,
6909
- NodeBuilderFlagsMask = 848330091,
6950
+ NodeBuilderFlagsMask = 848330095,
6910
6951
  }
6911
6952
  enum SymbolFormatFlags {
6912
6953
  None = 0,
@@ -6980,6 +7021,7 @@ declare namespace ts {
6980
7021
  Transient = 33554432,
6981
7022
  Assignment = 67108864,
6982
7023
  ModuleExports = 134217728,
7024
+ All = -1,
6983
7025
  Enum = 384,
6984
7026
  Variable = 3,
6985
7027
  Value = 111551,
@@ -7048,6 +7090,8 @@ declare namespace ts {
7048
7090
  ExportEquals = "export=",
7049
7091
  Default = "default",
7050
7092
  This = "this",
7093
+ InstantiationExpression = "__instantiationExpression",
7094
+ ImportAttributes = "__importAttributes",
7051
7095
  }
7052
7096
  /**
7053
7097
  * This represents a string whose leading underscore have been escaped by adding extra leading underscores.
@@ -7612,6 +7656,7 @@ declare namespace ts {
7612
7656
  ESNext = 99,
7613
7657
  Node16 = 100,
7614
7658
  NodeNext = 199,
7659
+ Preserve = 200,
7615
7660
  }
7616
7661
  enum JsxEmit {
7617
7662
  None = 0,
@@ -7890,6 +7935,7 @@ declare namespace ts {
7890
7935
  Unspecified = 4,
7891
7936
  EmbeddedStatement = 5,
7892
7937
  JsxAttributeValue = 6,
7938
+ ImportTypeNodeAttributes = 7,
7893
7939
  }
7894
7940
  enum OuterExpressionKinds {
7895
7941
  Parentheses = 1,
@@ -8762,6 +8808,7 @@ declare namespace ts {
8762
8808
  readonly organizeImportsNumericCollation?: boolean;
8763
8809
  readonly organizeImportsAccentCollation?: boolean;
8764
8810
  readonly organizeImportsCaseFirst?: "upper" | "lower" | false;
8811
+ readonly organizeImportsTypeOrder?: "first" | "last" | "inline";
8765
8812
  readonly excludeLibrarySymbolsInNavTo?: boolean;
8766
8813
  }
8767
8814
  /** Represents a bigint literal value without requiring bigint support */
@@ -9167,6 +9214,7 @@ declare namespace ts {
9167
9214
  function isForInitializer(node: Node): node is ForInitializer;
9168
9215
  function isModuleBody(node: Node): node is ModuleBody;
9169
9216
  function isNamedImportBindings(node: Node): node is NamedImportBindings;
9217
+ function isDeclarationStatement(node: Node): node is DeclarationStatement;
9170
9218
  function isStatement(node: Node): node is Statement;
9171
9219
  function isModuleReference(node: Node): node is ModuleReference;
9172
9220
  function isJsxTagNameExpression(node: Node): node is JsxTagNameExpression;
@@ -9186,11 +9234,13 @@ declare namespace ts {
9186
9234
  function isJSDocLinkLike(node: Node): node is JSDocLink | JSDocLinkCode | JSDocLinkPlain;
9187
9235
  function hasRestParameter(s: SignatureDeclaration | JSDocSignature): boolean;
9188
9236
  function isRestParameter(node: ParameterDeclaration | JSDocParameterTag): boolean;
9237
+ function isInternalDeclaration(node: Node, sourceFile?: SourceFile): boolean;
9189
9238
  const unchangedTextChangeRange: TextChangeRange;
9190
9239
  type ParameterPropertyDeclaration = ParameterDeclaration & {
9191
9240
  parent: ConstructorDeclaration;
9192
9241
  name: Identifier;
9193
9242
  };
9243
+ function isPartOfTypeNode(node: Node): boolean;
9194
9244
  /**
9195
9245
  * This function checks multiple locations for JSDoc comments that apply to a host node.
9196
9246
  * At each location, the whole comment may apply to the node, or only a specific tag in
@@ -9829,7 +9879,7 @@ declare namespace ts {
9829
9879
  * @param visitor The callback used to visit each child.
9830
9880
  * @param context A lexical environment context for the visitor.
9831
9881
  */
9832
- function visitEachChild<T extends Node>(node: T, visitor: Visitor, context: TransformationContext): T;
9882
+ function visitEachChild<T extends Node>(node: T, visitor: Visitor, context: TransformationContext | undefined): T;
9833
9883
  /**
9834
9884
  * Visits each child of a Node using the supplied visitor, possibly returning a new Node of the same kind in its place.
9835
9885
  *
@@ -9837,7 +9887,7 @@ declare namespace ts {
9837
9887
  * @param visitor The callback used to visit each child.
9838
9888
  * @param context A lexical environment context for the visitor.
9839
9889
  */
9840
- function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
9890
+ function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext | undefined, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
9841
9891
  function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions): string | undefined;
9842
9892
  function getOutputFileNames(commandLine: ParsedCommandLine, inputFileName: string, ignoreCase: boolean): readonly string[];
9843
9893
  function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer;
@@ -9868,37 +9918,50 @@ declare namespace ts {
9868
9918
  */
9869
9919
  function getModeForFileReference(ref: FileReference | string, containingFileMode: ResolutionMode): ResolutionMode;
9870
9920
  /**
9871
- * Calculates the final resolution mode for an import at some index within a file's imports list. This is generally the explicitly
9872
- * 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).
9873
- * If you have an actual import node, prefer using getModeForUsageLocation on the reference string node.
9921
+ * Use `program.getModeForResolutionAtIndex`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
9922
+ * Calculates the final resolution mode for an import at some index within a file's `imports` list. This is the resolution mode
9923
+ * explicitly provided via import attributes, if present, or the syntax the usage would have if emitted to JavaScript. In
9924
+ * `--module node16` or `nodenext`, this may depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the
9925
+ * input syntax of the reference. In other `module` modes, when overriding import attributes are not provided, this function returns
9926
+ * `undefined`, as the result would have no impact on module resolution, emit, or type checking.
9874
9927
  * @param file File to fetch the resolution mode within
9875
9928
  * @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
9929
+ * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
9930
+ * should be the options of the referenced project, not the referencing project.
9876
9931
  */
9877
- function getModeForResolutionAtIndex(file: SourceFile, index: number): ResolutionMode;
9932
+ function getModeForResolutionAtIndex(file: SourceFile, index: number, compilerOptions: CompilerOptions): ResolutionMode;
9878
9933
  /**
9879
- * Calculates the final resolution mode for a given module reference node. This is generally the explicitly provided resolution mode, if
9880
- * one exists, or the mode of the containing source file. (Excepting import=require, which is always commonjs, and dynamic import, which is always esm).
9881
- * Notably, this function always returns `undefined` if the containing file has an `undefined` `impliedNodeFormat` - this field is only set when
9882
- * `moduleResolution` is `node16`+.
9934
+ * Use `program.getModeForUsageLocation`, which retrieves the correct `compilerOptions`, instead of this function whenever possible.
9935
+ * Calculates the final resolution mode for a given module reference node. This is the resolution mode explicitly provided via import
9936
+ * attributes, if present, or the syntax the usage would have if emitted to JavaScript. In `--module node16` or `nodenext`, this may
9937
+ * depend on the file's `impliedNodeFormat`. In `--module preserve`, it depends only on the input syntax of the reference. In other
9938
+ * `module` modes, when overriding import attributes are not provided, this function returns `undefined`, as the result would have no
9939
+ * impact on module resolution, emit, or type checking.
9883
9940
  * @param file The file the import or import-like reference is contained within
9884
9941
  * @param usage The module reference string
9942
+ * @param compilerOptions The compiler options for the program that owns the file. If the file belongs to a referenced project, the compiler options
9943
+ * should be the options of the referenced project, not the referencing project.
9885
9944
  * @returns The final resolution mode of the import
9886
9945
  */
9887
- function getModeForUsageLocation(file: {
9888
- impliedNodeFormat?: ResolutionMode;
9889
- }, usage: StringLiteralLike): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
9946
+ function getModeForUsageLocation(
9947
+ file: {
9948
+ impliedNodeFormat?: ResolutionMode;
9949
+ },
9950
+ usage: StringLiteralLike,
9951
+ compilerOptions: CompilerOptions,
9952
+ ): ModuleKind.CommonJS | ModuleKind.ESNext | undefined;
9890
9953
  function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[];
9891
9954
  /**
9892
9955
  * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the
9893
9956
  * `options` parameter.
9894
9957
  *
9895
- * @param fileName The normalized absolute path to check the format of (it need not exist on disk)
9958
+ * @param fileName The file name to check the format of (it need not exist on disk)
9896
9959
  * @param [packageJsonInfoCache] A cache for package file lookups - it's best to have a cache when this function is called often
9897
9960
  * @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data
9898
9961
  * @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution`
9899
9962
  * @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format
9900
9963
  */
9901
- function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode;
9964
+ function getImpliedNodeFormatForFile(fileName: string, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ResolutionMode;
9902
9965
  /**
9903
9966
  * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions'
9904
9967
  * that represent a compilation unit.
@@ -10416,7 +10479,7 @@ declare namespace ts {
10416
10479
  installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
10417
10480
  writeFile?(fileName: string, content: string): void;
10418
10481
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
10419
- jsDocParsingMode?: JSDocParsingMode;
10482
+ jsDocParsingMode?: JSDocParsingMode | undefined;
10420
10483
  }
10421
10484
  type WithMetadata<T> = T & {
10422
10485
  metadata?: unknown;
@@ -11085,6 +11148,10 @@ declare namespace ts {
11085
11148
  */
11086
11149
  fileToRename?: string;
11087
11150
  displayName: string;
11151
+ /**
11152
+ * Full display name of item to be renamed.
11153
+ * If item to be renamed is a file, then this is the original text of the module specifer
11154
+ */
11088
11155
  fullDisplayName: string;
11089
11156
  kind: ScriptElementKind;
11090
11157
  kindModifiers: string;
@@ -11612,6 +11679,7 @@ declare namespace ts {
11612
11679
  moduleName?: string;
11613
11680
  renamedDependencies?: MapLike<string>;
11614
11681
  transformers?: CustomTransformers;
11682
+ jsDocParsingMode?: JSDocParsingMode;
11615
11683
  }
11616
11684
  interface TranspileOutput {
11617
11685
  outputText: string;