typescript 5.3.0-dev.20230921 → 5.3.0-dev.20230923

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.
@@ -171,6 +171,7 @@ declare namespace ts {
171
171
  ProvideCallHierarchyIncomingCalls = "provideCallHierarchyIncomingCalls",
172
172
  ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls",
173
173
  ProvideInlayHints = "provideInlayHints",
174
+ WatchChange = "watchChange",
174
175
  }
175
176
  /**
176
177
  * A TypeScript Server message
@@ -1504,6 +1505,15 @@ declare namespace ts {
1504
1505
  interface CloseRequest extends FileRequest {
1505
1506
  command: CommandTypes.Close;
1506
1507
  }
1508
+ interface WatchChangeRequest extends Request {
1509
+ command: CommandTypes.WatchChange;
1510
+ arguments: WatchChangeRequestArgs;
1511
+ }
1512
+ interface WatchChangeRequestArgs {
1513
+ id: number;
1514
+ path: string;
1515
+ eventType: "create" | "delete" | "update";
1516
+ }
1507
1517
  /**
1508
1518
  * Request to obtain the list of files that should be regenerated if target file is recompiled.
1509
1519
  * NOTE: this us query-only operation and does not generate any output on disk.
@@ -2421,6 +2431,33 @@ declare namespace ts {
2421
2431
  */
2422
2432
  maxFileSize: number;
2423
2433
  }
2434
+ type CreateFileWatcherEventName = "createFileWatcher";
2435
+ interface CreateFileWatcherEvent extends Event {
2436
+ readonly event: CreateFileWatcherEventName;
2437
+ readonly body: CreateFileWatcherEventBody;
2438
+ }
2439
+ interface CreateFileWatcherEventBody {
2440
+ readonly id: number;
2441
+ readonly path: string;
2442
+ }
2443
+ type CreateDirectoryWatcherEventName = "createDirectoryWatcher";
2444
+ interface CreateDirectoryWatcherEvent extends Event {
2445
+ readonly event: CreateDirectoryWatcherEventName;
2446
+ readonly body: CreateDirectoryWatcherEventBody;
2447
+ }
2448
+ interface CreateDirectoryWatcherEventBody {
2449
+ readonly id: number;
2450
+ readonly path: string;
2451
+ readonly recursive: boolean;
2452
+ }
2453
+ type CloseFileWatcherEventName = "closeFileWatcher";
2454
+ interface CloseFileWatcherEvent extends Event {
2455
+ readonly event: CloseFileWatcherEventName;
2456
+ readonly body: CloseFileWatcherEventBody;
2457
+ }
2458
+ interface CloseFileWatcherEventBody {
2459
+ readonly id: number;
2460
+ }
2424
2461
  /**
2425
2462
  * Arguments for reload request.
2426
2463
  */
@@ -3295,6 +3332,7 @@ declare namespace ts {
3295
3332
  isNonTsProject(): boolean;
3296
3333
  isJsOnlyProject(): boolean;
3297
3334
  static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined;
3335
+ readonly jsDocParsingMode: JSDocParsingMode | undefined;
3298
3336
  isKnownTypesPackageName(name: string): boolean;
3299
3337
  installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
3300
3338
  private get typingsCache();
@@ -3527,6 +3565,21 @@ declare namespace ts {
3527
3565
  readonly eventName: typeof OpenFileInfoTelemetryEvent;
3528
3566
  readonly data: OpenFileInfoTelemetryEventData;
3529
3567
  }
3568
+ const CreateFileWatcherEvent: protocol.CreateFileWatcherEventName;
3569
+ interface CreateFileWatcherEvent {
3570
+ readonly eventName: protocol.CreateFileWatcherEventName;
3571
+ readonly data: protocol.CreateFileWatcherEventBody;
3572
+ }
3573
+ const CreateDirectoryWatcherEvent: protocol.CreateDirectoryWatcherEventName;
3574
+ interface CreateDirectoryWatcherEvent {
3575
+ readonly eventName: protocol.CreateDirectoryWatcherEventName;
3576
+ readonly data: protocol.CreateDirectoryWatcherEventBody;
3577
+ }
3578
+ const CloseFileWatcherEvent: protocol.CloseFileWatcherEventName;
3579
+ interface CloseFileWatcherEvent {
3580
+ readonly eventName: protocol.CloseFileWatcherEventName;
3581
+ readonly data: protocol.CloseFileWatcherEventBody;
3582
+ }
3530
3583
  interface ProjectInfoTelemetryEventData {
3531
3584
  /** Cryptographically secure hash of project file location. */
3532
3585
  readonly projectId: string;
@@ -3574,7 +3627,7 @@ declare namespace ts {
3574
3627
  interface OpenFileInfo {
3575
3628
  readonly checkJs: boolean;
3576
3629
  }
3577
- type ProjectServiceEvent = LargeFileReferencedEvent | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent | OpenFileInfoTelemetryEvent;
3630
+ type ProjectServiceEvent = LargeFileReferencedEvent | ProjectsUpdatedInBackgroundEvent | ProjectLoadingStartEvent | ProjectLoadingFinishEvent | ConfigFileDiagEvent | ProjectLanguageServiceStateEvent | ProjectInfoTelemetryEvent | OpenFileInfoTelemetryEvent | CreateFileWatcherEvent | CreateDirectoryWatcherEvent | CloseFileWatcherEvent;
3578
3631
  type ProjectServiceEventHandler = (event: ProjectServiceEvent) => void;
3579
3632
  interface SafeList {
3580
3633
  [name: string]: {
@@ -3608,6 +3661,7 @@ declare namespace ts {
3608
3661
  useInferredProjectPerProjectRoot: boolean;
3609
3662
  typingsInstaller?: ITypingsInstaller;
3610
3663
  eventHandler?: ProjectServiceEventHandler;
3664
+ canUseWatchEvents?: boolean;
3611
3665
  suppressDiagnosticEvents?: boolean;
3612
3666
  throttleWaitMilliseconds?: number;
3613
3667
  globalPlugins?: readonly string[];
@@ -3616,6 +3670,7 @@ declare namespace ts {
3616
3670
  typesMapLocation?: string;
3617
3671
  serverMode?: LanguageServiceMode;
3618
3672
  session: Session<unknown> | undefined;
3673
+ jsDocParsingMode?: JSDocParsingMode;
3619
3674
  }
3620
3675
  interface WatchOptionsAndErrors {
3621
3676
  watchOptions: WatchOptions;
@@ -3678,7 +3733,6 @@ declare namespace ts {
3678
3733
  readonly typingsInstaller: ITypingsInstaller;
3679
3734
  private readonly globalCacheLocationDirectoryPath;
3680
3735
  readonly throttleWaitMilliseconds?: number;
3681
- private readonly eventHandler?;
3682
3736
  private readonly suppressDiagnosticEvents?;
3683
3737
  readonly globalPlugins: readonly string[];
3684
3738
  readonly pluginProbeLocations: readonly string[];
@@ -3690,6 +3744,7 @@ declare namespace ts {
3690
3744
  private performanceEventHandler?;
3691
3745
  private pendingPluginEnablements?;
3692
3746
  private currentPluginEnablementPromise?;
3747
+ readonly jsDocParsingMode: JSDocParsingMode | undefined;
3693
3748
  constructor(opts: ProjectServiceOptions);
3694
3749
  toPath(fileName: string): Path;
3695
3750
  private loadTypesMap;
@@ -3891,6 +3946,7 @@ declare namespace ts {
3891
3946
  * If falsy, all events are suppressed.
3892
3947
  */
3893
3948
  canUseEvents: boolean;
3949
+ canUseWatchEvents?: boolean;
3894
3950
  eventHandler?: ProjectServiceEventHandler;
3895
3951
  /** Has no effect if eventHandler is also specified. */
3896
3952
  suppressDiagnosticEvents?: boolean;
@@ -7257,6 +7313,7 @@ declare namespace ts {
7257
7313
  declaration?: SignatureDeclaration | JSDocSignature;
7258
7314
  typeParameters?: readonly TypeParameter[];
7259
7315
  parameters: readonly Symbol[];
7316
+ thisParameter?: Symbol;
7260
7317
  }
7261
7318
  interface Signature {
7262
7319
  getDeclaration(): SignatureDeclaration;
@@ -7750,6 +7807,7 @@ declare namespace ts {
7750
7807
  hasInvalidatedResolutions?(filePath: Path): boolean;
7751
7808
  createHash?(data: string): string;
7752
7809
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
7810
+ jsDocParsingMode?: JSDocParsingMode;
7753
7811
  }
7754
7812
  interface SourceMapRange extends TextRange {
7755
7813
  source?: SourceMapSource;
@@ -8607,6 +8665,33 @@ declare namespace ts {
8607
8665
  IndexSignatureParameters = 8848,
8608
8666
  JSDocComment = 33,
8609
8667
  }
8668
+ enum JSDocParsingMode {
8669
+ /**
8670
+ * Always parse JSDoc comments and include them in the AST.
8671
+ *
8672
+ * This is the default if no mode is provided.
8673
+ */
8674
+ ParseAll = 0,
8675
+ /**
8676
+ * Never parse JSDoc comments, mo matter the file type.
8677
+ */
8678
+ ParseNone = 1,
8679
+ /**
8680
+ * Parse only JSDoc comments which are needed to provide correct type errors.
8681
+ *
8682
+ * This will always parse JSDoc in non-TS files, but only parse JSDoc comments
8683
+ * containing `@see` and `@link` in TS files.
8684
+ */
8685
+ ParseForTypeErrors = 2,
8686
+ /**
8687
+ * Parse only JSDoc comments which are needed to provide correct type info.
8688
+ *
8689
+ * This will always parse JSDoc in non-TS files, but never in TS files.
8690
+ *
8691
+ * Note: Do not use this mode if you require accurate type errors; use {@link ParseForTypeErrors} instead.
8692
+ */
8693
+ ParseForTypeInfo = 3,
8694
+ }
8610
8695
  interface UserPreferences {
8611
8696
  readonly disableSuggestions?: boolean;
8612
8697
  readonly quotePreference?: "auto" | "double" | "single";
@@ -8768,6 +8853,8 @@ declare namespace ts {
8768
8853
  setOnError(onError: ErrorCallback | undefined): void;
8769
8854
  setScriptTarget(scriptTarget: ScriptTarget): void;
8770
8855
  setLanguageVariant(variant: LanguageVariant): void;
8856
+ setScriptKind(scriptKind: ScriptKind): void;
8857
+ setJSDocParsingMode(kind: JSDocParsingMode): void;
8771
8858
  /** @deprecated use {@link resetTokenState} */
8772
8859
  setTextPos(textPos: number): void;
8773
8860
  resetTokenState(pos: number): void;
@@ -9437,6 +9524,7 @@ declare namespace ts {
9437
9524
  * check specified by `isFileProbablyExternalModule` will be used to set the field.
9438
9525
  */
9439
9526
  setExternalModuleIndicator?: (file: SourceFile) => void;
9527
+ jsDocParsingMode?: JSDocParsingMode;
9440
9528
  }
9441
9529
  function parseCommandLine(commandLine: readonly string[], readFile?: (path: string) => string | undefined): ParsedCommandLine;
9442
9530
  /**
@@ -10027,6 +10115,7 @@ declare namespace ts {
10027
10115
  * 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
10028
10116
  */
10029
10117
  getModuleResolutionCache?(): ModuleResolutionCache | undefined;
10118
+ jsDocParsingMode?: JSDocParsingMode;
10030
10119
  }
10031
10120
  interface WatchCompilerHost<T extends BuilderProgram> extends ProgramHost<T>, WatchHost {
10032
10121
  /** Instead of using output d.ts file from project reference, use its source file */
@@ -10277,6 +10366,7 @@ declare namespace ts {
10277
10366
  installPackage?(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
10278
10367
  writeFile?(fileName: string, content: string): void;
10279
10368
  getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
10369
+ jsDocParsingMode?: JSDocParsingMode;
10280
10370
  }
10281
10371
  type WithMetadata<T> = T & {
10282
10372
  metadata?: unknown;
@@ -11374,7 +11464,7 @@ declare namespace ts {
11374
11464
  fileName: string;
11375
11465
  highlightSpans: HighlightSpan[];
11376
11466
  }
11377
- function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
11467
+ function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string, jsDocParsingMode?: JSDocParsingMode): DocumentRegistry;
11378
11468
  /**
11379
11469
  * The document registry represents a store of SourceFile objects that can be shared between
11380
11470
  * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST)