@typescript-deploys/pr-build 5.0.0-pr-52280-2 → 5.0.0-pr-52280-7

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.
@@ -3729,7 +3729,7 @@ declare namespace ts {
3729
3729
  private enableRequestedPluginsForProjectAsync;
3730
3730
  configurePlugin(args: protocol.ConfigurePluginRequestArguments): void;
3731
3731
  }
3732
- function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string;
3732
+ function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string;
3733
3733
  interface ServerCancellationToken extends HostCancellationToken {
3734
3734
  setRequest(requestId: number): void;
3735
3735
  resetRequest(requestId: number): void;
@@ -3751,8 +3751,14 @@ declare namespace ts {
3751
3751
  useSingleInferredProject: boolean;
3752
3752
  useInferredProjectPerProjectRoot: boolean;
3753
3753
  typingsInstaller: ITypingsInstaller;
3754
- byteLength: (buf: string, encoding?: string) => number;
3755
- hrtime: (start?: number[]) => number[];
3754
+ byteLength: (buf: string, encoding?: BufferEncoding) => number;
3755
+ hrtime: (start?: [
3756
+ number,
3757
+ number
3758
+ ]) => [
3759
+ number,
3760
+ number
3761
+ ];
3756
3762
  logger: Logger;
3757
3763
  /**
3758
3764
  * If falsy, all events are suppressed.
@@ -3781,7 +3787,7 @@ declare namespace ts {
3781
3787
  protected host: ServerHost;
3782
3788
  private readonly cancellationToken;
3783
3789
  protected readonly typingsInstaller: ITypingsInstaller;
3784
- protected byteLength: (buf: string, encoding?: string) => number;
3790
+ protected byteLength: (buf: string, encoding?: BufferEncoding) => number;
3785
3791
  private hrtime;
3786
3792
  protected logger: Logger;
3787
3793
  protected canUseEvents: boolean;
@@ -7822,10 +7828,10 @@ declare namespace ts {
7822
7828
  updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocReadonlyTag;
7823
7829
  createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocUnknownTag;
7824
7830
  updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray<JSDocComment> | undefined): JSDocUnknownTag;
7825
- createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocDeprecatedTag;
7826
- updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocDeprecatedTag;
7827
- createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocOverrideTag;
7828
- updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray<JSDocComment>): JSDocOverrideTag;
7831
+ createJSDocDeprecatedTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocDeprecatedTag;
7832
+ updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocDeprecatedTag;
7833
+ createJSDocOverrideTag(tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocOverrideTag;
7834
+ updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier | undefined, comment?: string | NodeArray<JSDocComment>): JSDocOverrideTag;
7829
7835
  createJSDocThrowsTag(tagName: Identifier, typeExpression: JSDocTypeExpression | undefined, comment?: string | NodeArray<JSDocComment>): JSDocThrowsTag;
7830
7836
  updateJSDocThrowsTag(node: JSDocThrowsTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment?: string | NodeArray<JSDocComment> | undefined): JSDocThrowsTag;
7831
7837
  createJSDocSatisfiesTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocSatisfiesTag;
@@ -8192,16 +8198,39 @@ declare namespace ts {
8192
8198
  /**
8193
8199
  * A function that accepts and possibly transforms a node.
8194
8200
  */
8195
- type Visitor = (node: Node) => VisitResult<Node>;
8201
+ type Visitor<TIn extends Node = Node, TOut extends Node | undefined = TIn | undefined> = (node: TIn) => VisitResult<TOut>;
8202
+ /**
8203
+ * A function that walks a node using the given visitor, lifting node arrays into single nodes,
8204
+ * returning an node which satisfies the test.
8205
+ *
8206
+ * - If the input node is undefined, then the output is undefined.
8207
+ * - If the visitor returns undefined, then the output is undefined.
8208
+ * - If the output node is not undefined, then it will satisfy the test function.
8209
+ * - In order to obtain a return type that is more specific than `Node`, a test
8210
+ * function _must_ be provided, and that function must be a type predicate.
8211
+ *
8212
+ * For the canonical implementation of this type, @see {visitNode}.
8213
+ */
8196
8214
  interface NodeVisitor {
8197
- <T extends Node>(nodes: T, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T;
8198
- <T extends Node>(nodes: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T | undefined;
8215
+ <TIn extends Node | undefined, TVisited extends Node | undefined, TOut extends Node>(node: TIn, visitor: Visitor<NonNullable<TIn>, TVisited>, test: (node: Node) => node is TOut, lift?: (node: readonly Node[]) => Node): TOut | (TIn & undefined) | (TVisited & undefined);
8216
+ <TIn extends Node | undefined, TVisited extends Node | undefined>(node: TIn, visitor: Visitor<NonNullable<TIn>, TVisited>, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => Node): Node | (TIn & undefined) | (TVisited & undefined);
8199
8217
  }
8218
+ /**
8219
+ * A function that walks a node array using the given visitor, returning an array whose contents satisfy the test.
8220
+ *
8221
+ * - If the input node array is undefined, the output is undefined.
8222
+ * - If the visitor can return undefined, the node it visits in the array will be reused.
8223
+ * - If the output node array is not undefined, then its contents will satisfy the test.
8224
+ * - In order to obtain a return type that is more specific than `NodeArray<Node>`, a test
8225
+ * function _must_ be provided, and that function must be a type predicate.
8226
+ *
8227
+ * For the canonical implementation of this type, @see {visitNodes}.
8228
+ */
8200
8229
  interface NodesVisitor {
8201
- <T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
8202
- <T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
8230
+ <TIn extends Node, TInArray extends NodeArray<TIn> | undefined, TOut extends Node>(nodes: TInArray, visitor: Visitor<TIn, Node | undefined>, test: (node: Node) => node is TOut, start?: number, count?: number): NodeArray<TOut> | (TInArray & undefined);
8231
+ <TIn extends Node, TInArray extends NodeArray<TIn> | undefined>(nodes: TInArray, visitor: Visitor<TIn, Node | undefined>, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<Node> | (TInArray & undefined);
8203
8232
  }
8204
- type VisitResult<T extends Node> = T | readonly T[] | undefined;
8233
+ type VisitResult<T extends Node | undefined> = T | readonly Node[];
8205
8234
  interface Printer {
8206
8235
  /**
8207
8236
  * Print a node and its subtree as-is, without any emit transformations.
@@ -8415,6 +8444,7 @@ declare namespace ts {
8415
8444
  }
8416
8445
  type FileWatcherCallback = (fileName: string, eventKind: FileWatcherEventKind, modifiedTime?: Date) => void;
8417
8446
  type DirectoryWatcherCallback = (fileName: string) => void;
8447
+ type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex";
8418
8448
  interface System {
8419
8449
  args: string[];
8420
8450
  newLine: string;
@@ -8473,8 +8503,8 @@ declare namespace ts {
8473
8503
  function forEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
8474
8504
  function forEachTrailingCommentRange<U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean) => U): U | undefined;
8475
8505
  function forEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T): U | undefined;
8476
- function reduceEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U | undefined;
8477
- function reduceEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T, memo: U) => U, state: T, initial: U): U | undefined;
8506
+ function reduceEachLeadingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T, initial: U): U | undefined;
8507
+ function reduceEachTrailingCommentRange<T, U>(text: string, pos: number, cb: (pos: number, end: number, kind: CommentKind, hasTrailingNewLine: boolean, state: T) => U, state: T, initial: U): U | undefined;
8478
8508
  function getLeadingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
8479
8509
  function getTrailingCommentRanges(text: string, pos: number): CommentRange[] | undefined;
8480
8510
  /** Optionally, get the shebang */
@@ -8553,7 +8583,7 @@ declare namespace ts {
8553
8583
  function getTypeParameterOwner(d: Declaration): Declaration | undefined;
8554
8584
  function isParameterPropertyDeclaration(node: Node, parent: Node): node is ParameterPropertyDeclaration;
8555
8585
  function isEmptyBindingPattern(node: BindingName): node is BindingPattern;
8556
- function isEmptyBindingElement(node: BindingElement): boolean;
8586
+ function isEmptyBindingElement(node: BindingElement | ArrayBindingElement): boolean;
8557
8587
  function walkUpBindingElementsAndPatterns(binding: BindingElement): VariableDeclaration | ParameterDeclaration;
8558
8588
  function getCombinedModifierFlags(node: Declaration): ModifierFlags;
8559
8589
  function getCombinedNodeFlags(node: Node): NodeFlags;
@@ -8570,7 +8600,7 @@ declare namespace ts {
8570
8600
  function getOriginalNode(node: Node): Node;
8571
8601
  function getOriginalNode<T extends Node>(node: Node, nodeTest: (node: Node) => node is T): T;
8572
8602
  function getOriginalNode(node: Node | undefined): Node | undefined;
8573
- function getOriginalNode<T extends Node>(node: Node | undefined, nodeTest: (node: Node | undefined) => node is T): T | undefined;
8603
+ function getOriginalNode<T extends Node>(node: Node | undefined, nodeTest: (node: Node) => node is T): T | undefined;
8574
8604
  /**
8575
8605
  * Iterates through the parent chain of a node and performs the callback on each parent until the callback
8576
8606
  * returns a truthy value, then returns that value.
@@ -9288,41 +9318,65 @@ declare namespace ts {
9288
9318
  /**
9289
9319
  * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
9290
9320
  *
9321
+ * - If the input node is undefined, then the output is undefined.
9322
+ * - If the visitor returns undefined, then the output is undefined.
9323
+ * - If the output node is not undefined, then it will satisfy the test function.
9324
+ * - In order to obtain a return type that is more specific than `Node`, a test
9325
+ * function _must_ be provided, and that function must be a type predicate.
9326
+ *
9291
9327
  * @param node The Node to visit.
9292
9328
  * @param visitor The callback used to visit the Node.
9293
9329
  * @param test A callback to execute to verify the Node is valid.
9294
9330
  * @param lift An optional callback to execute to lift a NodeArray into a valid Node.
9295
9331
  */
9296
- function visitNode<T extends Node>(node: T, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T;
9332
+ function visitNode<TIn extends Node | undefined, TVisited extends Node | undefined, TOut extends Node>(node: TIn, visitor: Visitor<NonNullable<TIn>, TVisited>, test: (node: Node) => node is TOut, lift?: (node: readonly Node[]) => Node): TOut | (TIn & undefined) | (TVisited & undefined);
9297
9333
  /**
9298
9334
  * Visits a Node using the supplied visitor, possibly returning a new Node in its place.
9299
9335
  *
9336
+ * - If the input node is undefined, then the output is undefined.
9337
+ * - If the visitor returns undefined, then the output is undefined.
9338
+ * - If the output node is not undefined, then it will satisfy the test function.
9339
+ * - In order to obtain a return type that is more specific than `Node`, a test
9340
+ * function _must_ be provided, and that function must be a type predicate.
9341
+ *
9300
9342
  * @param node The Node to visit.
9301
9343
  * @param visitor The callback used to visit the Node.
9302
9344
  * @param test A callback to execute to verify the Node is valid.
9303
9345
  * @param lift An optional callback to execute to lift a NodeArray into a valid Node.
9304
9346
  */
9305
- function visitNode<T extends Node>(node: T | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => T): T | undefined;
9347
+ function visitNode<TIn extends Node | undefined, TVisited extends Node | undefined>(node: TIn, visitor: Visitor<NonNullable<TIn>, TVisited>, test?: (node: Node) => boolean, lift?: (node: readonly Node[]) => Node): Node | (TIn & undefined) | (TVisited & undefined);
9306
9348
  /**
9307
9349
  * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
9308
9350
  *
9351
+ * - If the input node array is undefined, the output is undefined.
9352
+ * - If the visitor can return undefined, the node it visits in the array will be reused.
9353
+ * - If the output node array is not undefined, then its contents will satisfy the test.
9354
+ * - In order to obtain a return type that is more specific than `NodeArray<Node>`, a test
9355
+ * function _must_ be provided, and that function must be a type predicate.
9356
+ *
9309
9357
  * @param nodes The NodeArray to visit.
9310
9358
  * @param visitor The callback used to visit a Node.
9311
9359
  * @param test A node test to execute for each node.
9312
9360
  * @param start An optional value indicating the starting offset at which to start visiting.
9313
9361
  * @param count An optional value indicating the maximum number of nodes to visit.
9314
9362
  */
9315
- function visitNodes<T extends Node>(nodes: NodeArray<T>, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T>;
9363
+ function visitNodes<TIn extends Node, TInArray extends NodeArray<TIn> | undefined, TOut extends Node>(nodes: TInArray, visitor: Visitor<TIn, Node | undefined>, test: (node: Node) => node is TOut, start?: number, count?: number): NodeArray<TOut> | (TInArray & undefined);
9316
9364
  /**
9317
9365
  * Visits a NodeArray using the supplied visitor, possibly returning a new NodeArray in its place.
9318
9366
  *
9367
+ * - If the input node array is undefined, the output is undefined.
9368
+ * - If the visitor can return undefined, the node it visits in the array will be reused.
9369
+ * - If the output node array is not undefined, then its contents will satisfy the test.
9370
+ * - In order to obtain a return type that is more specific than `NodeArray<Node>`, a test
9371
+ * function _must_ be provided, and that function must be a type predicate.
9372
+ *
9319
9373
  * @param nodes The NodeArray to visit.
9320
9374
  * @param visitor The callback used to visit a Node.
9321
9375
  * @param test A node test to execute for each node.
9322
9376
  * @param start An optional value indicating the starting offset at which to start visiting.
9323
9377
  * @param count An optional value indicating the maximum number of nodes to visit.
9324
9378
  */
9325
- function visitNodes<T extends Node>(nodes: NodeArray<T> | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<T> | undefined;
9379
+ function visitNodes<TIn extends Node, TInArray extends NodeArray<TIn> | undefined>(nodes: TInArray, visitor: Visitor<TIn, Node | undefined>, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray<Node> | (TInArray & undefined);
9326
9380
  /**
9327
9381
  * Starts a new lexical environment and visits a statement list, ending the lexical environment
9328
9382
  * and merging hoisted declarations upon completion.