diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-07-03 15:09:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-03 16:09:54 +0200 |
commit | 3242e2718fdbbdb6d1855c0f694e816f9af3f09c (patch) | |
tree | ee058f886a717a1571d247ef94d95ace14ef4055 /cli/tsc/dts | |
parent | 496ea5903bbe8e86185c30fc6f478b0092d64d65 (diff) |
feat: Upgrade to TypeScript 5.5.2 (#24326)
This commit upgrades TypeScript to 5.5.2.
https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/
Diffstat (limited to 'cli/tsc/dts')
23 files changed, 1428 insertions, 1440 deletions
diff --git a/cli/tsc/dts/lib.dom.asynciterable.d.ts b/cli/tsc/dts/lib.dom.asynciterable.d.ts index 3b2458f8d..28e1bfd80 100644 --- a/cli/tsc/dts/lib.dom.asynciterable.d.ts +++ b/cli/tsc/dts/lib.dom.asynciterable.d.ts @@ -28,7 +28,6 @@ interface FileSystemDirectoryHandle { } interface ReadableStream<R = any> { - [Symbol.asyncIterator](options?: { - preventCancel?: boolean; - }): AsyncIterableIterator<R>; + [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; + values(options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; } diff --git a/cli/tsc/dts/lib.dom.d.ts b/cli/tsc/dts/lib.dom.d.ts index 1fa8798cb..6ee95c529 100644 --- a/cli/tsc/dts/lib.dom.d.ts +++ b/cli/tsc/dts/lib.dom.d.ts @@ -15,7 +15,6 @@ and limitations under the License. /// <reference no-default-lib="true"/> -/// <reference lib="dom.extras" /> ///////////////////////////// /// Window APIs @@ -220,6 +219,9 @@ interface ChannelSplitterOptions extends AudioNodeOptions { interface CheckVisibilityOptions { checkOpacity?: boolean; checkVisibilityCSS?: boolean; + contentVisibilityAuto?: boolean; + opacityProperty?: boolean; + visibilityProperty?: boolean; } interface ClientQueryOptions { @@ -286,6 +288,10 @@ interface ConstrainULongRange extends ULongRange { ideal?: number; } +interface ContentVisibilityAutoStateChangeEventInit extends EventInit { + skipped?: boolean; +} + interface ConvolverOptions extends AudioNodeOptions { buffer?: AudioBuffer | null; disableNormalization?: boolean; @@ -575,6 +581,8 @@ interface GainOptions extends AudioNodeOptions { interface GamepadEffectParameters { duration?: number; + leftTrigger?: number; + rightTrigger?: number; startDelay?: number; strongMagnitude?: number; weakMagnitude?: number; @@ -1377,8 +1385,8 @@ interface RTCIceCandidateInit { } interface RTCIceCandidatePair { - local?: RTCIceCandidate; - remote?: RTCIceCandidate; + local: RTCIceCandidate; + remote: RTCIceCandidate; } interface RTCIceCandidatePairStats extends RTCStats { @@ -1638,6 +1646,17 @@ interface ReadableStreamGetReaderOptions { mode?: ReadableStreamReaderMode; } +interface ReadableStreamIteratorOptions { + /** + * Asynchronously iterates over the chunks in the stream's internal queue. + * + * Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader. The lock will be released if the async iterator's return() method is called, e.g. by breaking out of the loop. + * + * By default, calling the async iterator's return() method will also cancel the stream. To prevent this, use the stream's values() method, passing true for the preventCancel option. + */ + preventCancel?: boolean; +} + interface ReadableStreamReadDoneResult<T> { done: true; value?: T; @@ -1769,21 +1788,22 @@ interface ScrollToOptions extends ScrollOptions { interface SecurityPolicyViolationEventInit extends EventInit { blockedURI?: string; columnNumber?: number; - disposition: SecurityPolicyViolationEventDisposition; - documentURI: string; - effectiveDirective: string; + disposition?: SecurityPolicyViolationEventDisposition; + documentURI?: string; + effectiveDirective?: string; lineNumber?: number; - originalPolicy: string; + originalPolicy?: string; referrer?: string; sample?: string; sourceFile?: string; - statusCode: number; - violatedDirective: string; + statusCode?: number; + violatedDirective?: string; } interface ShadowRootInit { delegatesFocus?: boolean; mode: ShadowRootMode; + serializable?: boolean; slotAssignment?: SlotAssignmentMode; } @@ -2208,6 +2228,8 @@ interface ARIAMixin { ariaAtomic: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ ariaAutoComplete: string | null; + ariaBrailleLabel: string | null; + ariaBrailleRoleDescription: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ ariaBusy: string | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ @@ -2340,6 +2362,8 @@ declare var AbortSignal: { new(): AbortSignal; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */ abort(reason?: any): AbortSignal; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */ + any(signals: AbortSignal[]): AbortSignal; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */ timeout(milliseconds: number): AbortSignal; }; @@ -3793,6 +3817,16 @@ declare var CSSScale: { new(x: CSSNumberish, y: CSSNumberish, z?: CSSNumberish): CSSScale; }; +interface CSSScopeRule extends CSSGroupingRule { + readonly end: string | null; + readonly start: string | null; +} + +declare var CSSScopeRule: { + prototype: CSSScopeRule; + new(): CSSScopeRule; +}; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew) */ interface CSSSkew extends CSSTransformComponent { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew/ax) */ @@ -3828,6 +3862,15 @@ declare var CSSSkewY: { new(ay: CSSNumericValue): CSSSkewY; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStartingStyleRule) */ +interface CSSStartingStyleRule extends CSSGroupingRule { +} + +declare var CSSStartingStyleRule: { + prototype: CSSStartingStyleRule; + new(): CSSStartingStyleRule; +}; + /** * An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. * @@ -4053,6 +4096,7 @@ interface CSSStyleDeclaration { clipRule: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color) */ color: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color-interpolation) */ colorInterpolation: string; colorInterpolationFilters: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color-scheme) */ @@ -4097,6 +4141,8 @@ interface CSSStyleDeclaration { containerType: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/content) */ content: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/content-visibility) */ + contentVisibility: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-increment) */ counterIncrement: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-reset) */ @@ -4598,6 +4644,8 @@ interface CSSStyleDeclaration { textUnderlinePosition: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-wrap) */ textWrap: string; + textWrapMode: string; + textWrapStyle: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/top) */ top: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/touch-action) */ @@ -4612,6 +4660,8 @@ interface CSSStyleDeclaration { transformStyle: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition) */ transition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-behavior) */ + transitionBehavior: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-delay) */ transitionDelay: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-duration) */ @@ -5033,6 +5083,8 @@ interface CSSStyleDeclaration { webkitUserSelect: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/white-space) */ whiteSpace: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/white-space-collapse) */ + whiteSpaceCollapse: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/widows) */ widows: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/width) */ @@ -5051,6 +5103,8 @@ interface CSSStyleDeclaration { y: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/z-index) */ zIndex: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/zoom) */ + zoom: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/getPropertyPriority) */ getPropertyPriority(property: string): string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/getPropertyValue) */ @@ -5814,6 +5868,17 @@ declare var ConstantSourceNode: { new(context: BaseAudioContext, options?: ConstantSourceOptions): ConstantSourceNode; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ContentVisibilityAutoStateChangeEvent) */ +interface ContentVisibilityAutoStateChangeEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ContentVisibilityAutoStateChangeEvent/skipped) */ + readonly skipped: boolean; +} + +declare var ContentVisibilityAutoStateChangeEvent: { + prototype: ContentVisibilityAutoStateChangeEvent; + new(type: string, eventInitDict?: ContentVisibilityAutoStateChangeEventInit): ContentVisibilityAutoStateChangeEvent; +}; + /** * An AudioNode that performs a Linear Convolution on a given AudioBuffer, often used to achieve a reverb effect. A ConvolverNode always has exactly one input and one output. * @@ -5975,6 +6040,16 @@ declare var CustomEvent: { new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomStateSet) */ +interface CustomStateSet { + forEach(callbackfn: (value: string, key: string, parent: CustomStateSet) => void, thisArg?: any): void; +} + +declare var CustomStateSet: { + prototype: CustomStateSet; + new(): CustomStateSet; +}; + /** * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. * @@ -7163,6 +7238,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve createEvent(eventInterface: "ClipboardEvent"): ClipboardEvent; createEvent(eventInterface: "CloseEvent"): CloseEvent; createEvent(eventInterface: "CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "ContentVisibilityAutoStateChangeEvent"): ContentVisibilityAutoStateChangeEvent; createEvent(eventInterface: "CustomEvent"): CustomEvent; createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; @@ -7424,6 +7500,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve declare var Document: { prototype: Document; new(): Document; + parseHTMLUnsafe(html: string): Document; }; /** @@ -7874,6 +7951,7 @@ interface Element extends Node, ARIAMixin, Animatable, ChildNode, InnerHTML, Non setAttributeNode(attr: Attr): Attr | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNodeNS) */ setAttributeNodeNS(attr: Attr): Attr | null; + setHTMLUnsafe(html: string): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setPointerCapture) */ setPointerCapture(pointerId: number): void; /** @@ -7938,6 +8016,8 @@ interface ElementInternals extends ARIAMixin { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/shadowRoot) */ readonly shadowRoot: ShadowRoot | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/states) */ + readonly states: CustomStateSet; /** * Returns the error message that would be shown to the user if internals's target element was to be checked for validity. * @@ -8716,7 +8796,6 @@ declare var GainNode: { /** * This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. - * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad) */ @@ -8735,7 +8814,7 @@ interface Gamepad { readonly mapping: GamepadMappingType; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/timestamp) */ readonly timestamp: DOMHighResTimeStamp; - readonly vibrationActuator: GamepadHapticActuator | null; + readonly vibrationActuator: GamepadHapticActuator; } declare var Gamepad: { @@ -8745,7 +8824,6 @@ declare var Gamepad: { /** * An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. - * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton) */ @@ -8765,7 +8843,6 @@ declare var GamepadButton: { /** * This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. - * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadEvent) */ @@ -8785,8 +8862,6 @@ declare var GamepadEvent: { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadHapticActuator) */ interface GamepadHapticActuator { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadHapticActuator/type) */ - readonly type: GamepadHapticActuatorType; playEffect(type: GamepadHapticEffectType, params?: GamepadEffectParameters): Promise<GamepadHapticsResult>; reset(): Promise<GamepadHapticsResult>; } @@ -9497,6 +9572,7 @@ interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/name) */ name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/ping) */ ping: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/referrerPolicy) */ referrerPolicy: string; @@ -9574,6 +9650,7 @@ interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/noHref) */ noHref: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/ping) */ ping: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/referrerPolicy) */ referrerPolicy: string; @@ -10169,7 +10246,11 @@ declare var HTMLElement: { interface HTMLEmbedElement extends HTMLElement { /** @deprecated */ align: string; - /** Sets or retrieves the height of the object. */ + /** + * Sets or retrieves the height of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLEmbedElement/height) + */ height: string; /** * Sets or retrieves the name of the object. @@ -10179,7 +10260,11 @@ interface HTMLEmbedElement extends HTMLElement { /** Sets or retrieves a URL to be loaded by the object. */ src: string; type: string; - /** Sets or retrieves the width of the object. */ + /** + * Sets or retrieves the width of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLEmbedElement/width) + */ width: string; getSVGDocument(): Document | null; addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLEmbedElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -10752,6 +10837,7 @@ interface HTMLIFrameElement extends HTMLElement { */ align: string; allow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLIFrameElement/allowFullscreen) */ allowFullscreen: boolean; /** * Retrieves the document object of the page or frame. @@ -10778,6 +10864,7 @@ interface HTMLIFrameElement extends HTMLElement { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLIFrameElement/height) */ height: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLIFrameElement/loading) */ loading: string; /** * Sets or retrieves a URI to a long description of the object. @@ -11017,7 +11104,11 @@ interface HTMLInputElement extends HTMLElement, PopoverInvokerElement { checked: boolean; /** Sets or retrieves the state of the check box or radio button. */ defaultChecked: boolean; - /** Sets or retrieves the initial contents of the object. */ + /** + * Sets or retrieves the initial contents of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/defaultValue) + */ defaultValue: string; dirName: string; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/disabled) */ @@ -11076,12 +11167,25 @@ interface HTMLInputElement extends HTMLElement, PopoverInvokerElement { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/list) */ readonly list: HTMLDataListElement | null; - /** Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. */ + /** + * Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/max) + */ max: string; - /** Sets or retrieves the maximum number of characters that the user can enter in a text control. */ + /** + * Sets or retrieves the maximum number of characters that the user can enter in a text control. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/maxLength) + */ maxLength: number; - /** Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. */ + /** + * Defines the minimum acceptable value for an input element with type="number". When used with the max and step attributes, lets you control the range and increment (such as even numbers only) that the user can enter into an input field. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/min) + */ min: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/minLength) */ minLength: number; /** * Sets or retrieves the Boolean value indicating whether multiple items can be selected from a list. @@ -11112,16 +11216,28 @@ interface HTMLInputElement extends HTMLElement, PopoverInvokerElement { required: boolean; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionDirection) */ selectionDirection: "forward" | "backward" | "none" | null; - /** Gets or sets the end position or offset of a text selection. */ + /** + * Gets or sets the end position or offset of a text selection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionEnd) + */ selectionEnd: number | null; - /** Gets or sets the starting position or offset of a text selection. */ + /** + * Gets or sets the starting position or offset of a text selection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/selectionStart) + */ selectionStart: number | null; size: number; /** The address or URL of the a media resource that is to be considered. */ src: string; /** Defines an increment or jump between values that you want to allow the user to enter. When used with the max and min attributes, lets you control the range and increment (for example, allow only even numbers) that the user can enter into an input field. */ step: string; - /** Returns the content type of the object. */ + /** + * Returns the content type of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/type) + */ type: string; /** * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. @@ -11140,7 +11256,11 @@ interface HTMLInputElement extends HTMLElement, PopoverInvokerElement { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/validity) */ readonly validity: ValidityState; - /** Returns the value of the data at the cursor's current position. */ + /** + * Returns the value of the data at the cursor's current position. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/value) + */ value: string; /** Returns a Date object representing the form control's value, if applicable; otherwise, returns null. Can be set, to change the value. Throws an "InvalidStateError" DOMException if the control isn't date- or time-based. */ valueAsDate: Date | null; @@ -11700,16 +11820,31 @@ declare var HTMLMenuElement: { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMetaElement) */ interface HTMLMetaElement extends HTMLElement { - /** Gets or sets meta-information to associate with httpEquiv or name. */ + /** + * Gets or sets meta-information to associate with httpEquiv or name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMetaElement/content) + */ content: string; - /** Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. */ + /** + * Gets or sets information used to bind the value of a content attribute of a meta element to an HTTP response header. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMetaElement/httpEquiv) + */ httpEquiv: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMetaElement/media) */ media: string; - /** Sets or retrieves the value specified in the content attribute of the meta object. */ + /** + * Sets or retrieves the value specified in the content attribute of the meta object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMetaElement/name) + */ name: string; /** * Sets or retrieves a scheme to be used in interpreting the value of a property specified for the object. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMetaElement/scheme) */ scheme: string; addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLMetaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -11921,6 +12056,7 @@ interface HTMLObjectElement extends HTMLElement { type: string; /** * Sets or retrieves the URL, often with a bookmark extension (#name), to use as a client-side image map. + * @deprecated * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLObjectElement/useMap) */ @@ -12475,7 +12611,7 @@ interface HTMLSelectElement extends HTMLElement { * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLSelectElement/type) */ - readonly type: string; + readonly type: "select-one" | "select-multiple"; /** * Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. * @@ -12587,6 +12723,7 @@ declare var HTMLSlotElement: { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLSourceElement) */ interface HTMLSourceElement extends HTMLElement { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLSourceElement/height) */ height: number; /** * Gets or sets the intended media type of the media source. @@ -12610,6 +12747,7 @@ interface HTMLSourceElement extends HTMLElement { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLSourceElement/type) */ type: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLSourceElement/width) */ width: number; addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLSourceElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -13251,7 +13389,11 @@ interface HTMLTextAreaElement extends HTMLElement { selectionStart: number; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/textLength) */ readonly textLength: number; - /** Retrieves the type of control. */ + /** + * Retrieves the type of control. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTextAreaElement/type) + */ readonly type: string; /** Returns the error message that would be displayed if the user submits the form, or an empty string if no error message. It also triggers the standard error message, such as "this is a required field". The result is that the user sees validation messages without actually submitting. */ readonly validationMessage: string; @@ -13474,11 +13616,13 @@ interface HTMLVideoElement extends HTMLMediaElement { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/width) */ width: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/cancelVideoFrameCallback) */ cancelVideoFrameCallback(handle: number): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/getVideoPlaybackQuality) */ getVideoPlaybackQuality(): VideoPlaybackQuality; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/requestPictureInPicture) */ requestPictureInPicture(): Promise<PictureInPictureWindow>; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/requestVideoFrameCallback) */ requestVideoFrameCallback(callback: VideoFrameRequestCallback): number; addEventListener<K extends keyof HTMLVideoElementEventMap>(type: K, listener: (this: HTMLVideoElement, ev: HTMLVideoElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -14560,6 +14704,29 @@ declare var KeyframeEffect: { new(source: KeyframeEffect): KeyframeEffect; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint) */ +interface LargestContentfulPaint extends PerformanceEntry { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint/element) */ + readonly element: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint/id) */ + readonly id: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint/loadTime) */ + readonly loadTime: DOMHighResTimeStamp; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint/renderTime) */ + readonly renderTime: DOMHighResTimeStamp; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint/size) */ + readonly size: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint/url) */ + readonly url: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/LargestContentfulPaint/toJSON) */ + toJSON(): any; +} + +declare var LargestContentfulPaint: { + prototype: LargestContentfulPaint; + new(): LargestContentfulPaint; +}; + interface LinkStyle { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLLinkElement/sheet) */ readonly sheet: CSSStyleSheet | null; @@ -21397,6 +21564,8 @@ interface ShadowRootEventMap { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ShadowRoot) */ interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot, InnerHTML { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ShadowRoot/clonable) */ + readonly clonable: boolean; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ShadowRoot/delegatesFocus) */ readonly delegatesFocus: boolean; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ShadowRoot/host) */ @@ -21406,6 +21575,7 @@ interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot, InnerHTML { onslotchange: ((this: ShadowRoot, ev: Event) => any) | null; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ShadowRoot/slotAssignment) */ readonly slotAssignment: SlotAssignmentMode; + setHTMLUnsafe(html: string): void; /** Throws a "NotSupportedError" DOMException if context object is a shadow root. */ addEventListener<K extends keyof ShadowRootEventMap>(type: K, listener: (this: ShadowRoot, ev: ShadowRootEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -25928,7 +26098,11 @@ interface Window extends EventTarget, AnimationFrameProvider, GlobalEventHandler readonly window: Window & typeof globalThis; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */ alert(message?: any): void; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/blur) */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/blur) + */ blur(): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/cancelIdleCallback) */ cancelIdleCallback(handle: number): void; @@ -27553,7 +27727,11 @@ declare var visualViewport: VisualViewport | null; declare var window: Window & typeof globalThis; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/alert) */ declare function alert(message?: any): void; -/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/blur) */ +/** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/blur) + */ declare function blur(): void; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Window/cancelIdleCallback) */ declare function cancelIdleCallback(handle: number): void; @@ -28300,8 +28478,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap"; type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded"; type FontFaceSetLoadStatus = "loaded" | "loading"; type FullscreenNavigationUI = "auto" | "hide" | "show"; -type GamepadHapticActuatorType = "vibration"; -type GamepadHapticEffectType = "dual-rumble"; +type GamepadHapticEffectType = "dual-rumble" | "trigger-rumble"; type GamepadHapticsResult = "complete" | "preempted"; type GamepadMappingType = "" | "standard" | "xr-standard"; type GlobalCompositeOperation = "color" | "color-burn" | "color-dodge" | "copy" | "darken" | "destination-atop" | "destination-in" | "destination-out" | "destination-over" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "lighter" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | "source-atop" | "source-in" | "source-out" | "source-over" | "xor"; diff --git a/cli/tsc/dts/lib.dom.iterable.d.ts b/cli/tsc/dts/lib.dom.iterable.d.ts index 85ad944a7..f8ac3d9c1 100644 --- a/cli/tsc/dts/lib.dom.iterable.d.ts +++ b/cli/tsc/dts/lib.dom.iterable.d.ts @@ -20,6 +20,11 @@ and limitations under the License. /// Window Iterable APIs ///////////////////////////// +interface AbortSignal { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */ + any(signals: Iterable<AbortSignal>): AbortSignal; +} + interface AudioParam { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setValueCurveAtTime) */ setValueCurveAtTime(values: Iterable<number>, startTime: number, duration: number): AudioParam; @@ -83,6 +88,9 @@ interface CanvasPathDrawingStyles { setLineDash(segments: Iterable<number>): void; } +interface CustomStateSet extends Set<string> { +} + interface DOMRectList { [Symbol.iterator](): IterableIterator<DOMRect>; } diff --git a/cli/tsc/dts/lib.es2015.core.d.ts b/cli/tsc/dts/lib.es2015.core.d.ts index ab37bc49f..1b22b29b4 100644 --- a/cli/tsc/dts/lib.es2015.core.d.ts +++ b/cli/tsc/dts/lib.es2015.core.d.ts @@ -60,6 +60,8 @@ interface Array<T> { * @param end If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; + + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } interface ArrayConstructor { @@ -360,6 +362,8 @@ interface ReadonlyArray<T> { * predicate. If it is not provided, undefined is used instead. */ findIndex(predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any): number; + + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; } interface RegExp { @@ -555,3 +559,39 @@ interface StringConstructor { */ raw(template: { raw: readonly string[] | ArrayLike<string>; }, ...substitutions: any[]): string; } + +interface Int8Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Uint8Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Uint8ClampedArray { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Int16Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Uint16Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Int32Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Uint32Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Float32Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Float64Array { + toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions): string; +} diff --git a/cli/tsc/dts/lib.es2018.intl.d.ts b/cli/tsc/dts/lib.es2018.intl.d.ts index 8517ba938..04669d8e6 100644 --- a/cli/tsc/dts/lib.es2018.intl.d.ts +++ b/cli/tsc/dts/lib.es2018.intl.d.ts @@ -55,10 +55,22 @@ declare namespace Intl { const PluralRules: PluralRulesConstructor; - // We can only have one definition for 'type' in TypeScript, and so you can learn where the keys come from here: - type ES2018NumberFormatPartType = "literal" | "nan" | "infinity" | "percent" | "integer" | "group" | "decimal" | "fraction" | "plusSign" | "minusSign" | "percentSign" | "currency" | "code" | "symbol" | "name"; - type ES2020NumberFormatPartType = "compact" | "exponentInteger" | "exponentMinusSign" | "exponentSeparator" | "unit" | "unknown"; - type NumberFormatPartTypes = ES2018NumberFormatPartType | ES2020NumberFormatPartType; + interface NumberFormatPartTypeRegistry { + literal: never; + nan: never; + infinity: never; + percent: never; + integer: never; + group: never; + decimal: never; + fraction: never; + plusSign: never; + minusSign: never; + percentSign: never; + currency: never; + } + + type NumberFormatPartTypes = keyof NumberFormatPartTypeRegistry; interface NumberFormatPart { type: NumberFormatPartTypes; diff --git a/cli/tsc/dts/lib.es2019.intl.d.ts b/cli/tsc/dts/lib.es2019.intl.d.ts index 04e77c126..403dc87d8 100644 --- a/cli/tsc/dts/lib.es2019.intl.d.ts +++ b/cli/tsc/dts/lib.es2019.intl.d.ts @@ -18,6 +18,6 @@ and limitations under the License. declare namespace Intl { interface DateTimeFormatPartTypesRegistry { - unknown: any; + unknown: never; } } diff --git a/cli/tsc/dts/lib.es2020.bigint.d.ts b/cli/tsc/dts/lib.es2020.bigint.d.ts index d6b04d7a9..4b8939601 100644 --- a/cli/tsc/dts/lib.es2020.bigint.d.ts +++ b/cli/tsc/dts/lib.es2020.bigint.d.ts @@ -369,7 +369,7 @@ interface BigInt64Array { subarray(begin?: number, end?: number): BigInt64Array; /** Converts the array to a string by using the current locale. */ - toLocaleString(): string; + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; /** Returns a string representation of the array. */ toString(): string; @@ -641,7 +641,7 @@ interface BigUint64Array { subarray(begin?: number, end?: number): BigUint64Array; /** Converts the array to a string by using the current locale. */ - toLocaleString(): string; + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; /** Returns a string representation of the array. */ toString(): string; @@ -723,6 +723,5 @@ interface DataView { declare namespace Intl { interface NumberFormat { format(value: number | bigint): string; - resolvedOptions(): ResolvedNumberFormatOptions; } } diff --git a/cli/tsc/dts/lib.es2020.intl.d.ts b/cli/tsc/dts/lib.es2020.intl.d.ts index 59c0d7ebd..0da854e16 100644 --- a/cli/tsc/dts/lib.es2020.intl.d.ts +++ b/cli/tsc/dts/lib.es2020.intl.d.ts @@ -241,24 +241,49 @@ declare namespace Intl { ): UnicodeBCP47LocaleIdentifier[]; }; + interface NumberFormatOptionsStyleRegistry { + unit: never; + } + + interface NumberFormatOptionsCurrencyDisplayRegistry { + narrowSymbol: never; + } + + interface NumberFormatOptionsSignDisplayRegistry { + auto: never; + never: never; + always: never; + exceptZero: never; + } + + type NumberFormatOptionsSignDisplay = keyof NumberFormatOptionsSignDisplayRegistry; + interface NumberFormatOptions { + numberingSystem?: string | undefined; compactDisplay?: "short" | "long" | undefined; notation?: "standard" | "scientific" | "engineering" | "compact" | undefined; - signDisplay?: "auto" | "never" | "always" | "exceptZero" | undefined; + signDisplay?: NumberFormatOptionsSignDisplay | undefined; unit?: string | undefined; unitDisplay?: "short" | "long" | "narrow" | undefined; - currencyDisplay?: string | undefined; - currencySign?: string | undefined; + currencySign?: "standard" | "accounting" | undefined; } interface ResolvedNumberFormatOptions { compactDisplay?: "short" | "long"; - notation?: "standard" | "scientific" | "engineering" | "compact"; - signDisplay?: "auto" | "never" | "always" | "exceptZero"; + notation: "standard" | "scientific" | "engineering" | "compact"; + signDisplay: NumberFormatOptionsSignDisplay; unit?: string; unitDisplay?: "short" | "long" | "narrow"; - currencyDisplay?: string; - currencySign?: string; + currencySign?: "standard" | "accounting"; + } + + interface NumberFormatPartTypeRegistry { + compact: never; + exponentInteger: never; + exponentMinusSign: never; + exponentSeparator: never; + unit: never; + unknown: never; } interface DateTimeFormatOptions { diff --git a/cli/tsc/dts/lib.es2021.weakref.d.ts b/cli/tsc/dts/lib.es2021.weakref.d.ts index 986af60d4..48e76265a 100644 --- a/cli/tsc/dts/lib.es2021.weakref.d.ts +++ b/cli/tsc/dts/lib.es2021.weakref.d.ts @@ -60,7 +60,7 @@ interface FinalizationRegistry<T> { * @param unregisterToken The token that was used as the unregisterToken argument when calling * register to register the target value. */ - unregister(unregisterToken: WeakKey): void; + unregister(unregisterToken: WeakKey): boolean; } interface FinalizationRegistryConstructor { diff --git a/cli/tsc/dts/lib.es2022.regexp.d.ts b/cli/tsc/dts/lib.es2022.regexp.d.ts index 88ebbce9b..5a15cd49e 100644 --- a/cli/tsc/dts/lib.es2022.regexp.d.ts +++ b/cli/tsc/dts/lib.es2022.regexp.d.ts @@ -32,7 +32,7 @@ interface RegExpIndicesArray extends Array<[number, number]> { interface RegExp { /** - * Returns a Boolean value indicating the state of the hasIndices flag (d) used with with a regular expression. + * Returns a Boolean value indicating the state of the hasIndices flag (d) used with a regular expression. * Default is false. Read-only. */ readonly hasIndices: boolean; diff --git a/cli/tsc/dts/lib.es2023.d.ts b/cli/tsc/dts/lib.es2023.d.ts index b70830cea..13598a297 100644 --- a/cli/tsc/dts/lib.es2023.d.ts +++ b/cli/tsc/dts/lib.es2023.d.ts @@ -19,3 +19,4 @@ and limitations under the License. /// <reference lib="es2022" /> /// <reference lib="es2023.array" /> /// <reference lib="es2023.collection" /> +/// <reference lib="es2023.intl" /> diff --git a/cli/tsc/dts/lib.es2023.intl.d.ts b/cli/tsc/dts/lib.es2023.intl.d.ts new file mode 100644 index 000000000..654b51ca1 --- /dev/null +++ b/cli/tsc/dts/lib.es2023.intl.d.ts @@ -0,0 +1,56 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// <reference no-default-lib="true"/> + +declare namespace Intl { + interface NumberFormatOptionsUseGroupingRegistry { + min2: never; + auto: never; + always: never; + } + + interface NumberFormatOptionsSignDisplayRegistry { + negative: never; + } + + interface NumberFormatOptions { + roundingPriority?: "auto" | "morePrecision" | "lessPrecision" | undefined; + roundingIncrement?: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000 | undefined; + roundingMode?: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven" | undefined; + trailingZeroDisplay?: "auto" | "stripIfInteger" | undefined; + } + + interface ResolvedNumberFormatOptions { + roundingPriority: "auto" | "morePrecision" | "lessPrecision"; + roundingMode: "ceil" | "floor" | "expand" | "trunc" | "halfCeil" | "halfFloor" | "halfExpand" | "halfTrunc" | "halfEven"; + roundingIncrement: 1 | 2 | 5 | 10 | 20 | 25 | 50 | 100 | 200 | 250 | 500 | 1000 | 2000 | 2500 | 5000; + trailingZeroDisplay: "auto" | "stripIfInteger"; + } + + interface NumberRangeFormatPart extends NumberFormatPart { + source: "startRange" | "endRange" | "shared"; + } + + type StringNumericLiteral = `${number}` | "Infinity" | "-Infinity" | "+Infinity"; + + interface NumberFormat { + format(value: number | bigint | StringNumericLiteral): string; + formatToParts(value: number | bigint | StringNumericLiteral): NumberFormatPart[]; + formatRange(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): string; + formatRangeToParts(start: number | bigint | StringNumericLiteral, end: number | bigint | StringNumericLiteral): NumberRangeFormatPart[]; + } +} diff --git a/cli/tsc/dts/lib.es5.d.ts b/cli/tsc/dts/lib.es5.d.ts index dee445d07..cf9adfe1e 100644 --- a/cli/tsc/dts/lib.es5.d.ts +++ b/cli/tsc/dts/lib.es5.d.ts @@ -818,7 +818,7 @@ interface Date { getMilliseconds(): number; /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ getUTCMilliseconds(): number; - /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + /** Gets the difference in minutes between Universal Coordinated Time (UTC) and the time on the local computer. */ getTimezoneOffset(): number; /** * Sets the date and time value in the Date object. @@ -4433,12 +4433,33 @@ declare namespace Intl { var Collator: CollatorConstructor; + interface NumberFormatOptionsStyleRegistry { + decimal: never; + percent: never; + currency: never; + } + + type NumberFormatOptionsStyle = keyof NumberFormatOptionsStyleRegistry; + + interface NumberFormatOptionsCurrencyDisplayRegistry { + code: never; + symbol: never; + name: never; + } + + type NumberFormatOptionsCurrencyDisplay = keyof NumberFormatOptionsCurrencyDisplayRegistry; + + interface NumberFormatOptionsUseGroupingRegistry {} + + type NumberFormatOptionsUseGrouping = {} extends NumberFormatOptionsUseGroupingRegistry ? boolean : keyof NumberFormatOptionsUseGroupingRegistry | "true" | "false" | boolean; + type ResolvedNumberFormatOptionsUseGrouping = {} extends NumberFormatOptionsUseGroupingRegistry ? boolean : keyof NumberFormatOptionsUseGroupingRegistry | false; + interface NumberFormatOptions { - localeMatcher?: string | undefined; - style?: string | undefined; + localeMatcher?: "lookup" | "best fit" | undefined; + style?: NumberFormatOptionsStyle | undefined; currency?: string | undefined; - currencySign?: string | undefined; - useGrouping?: boolean | undefined; + currencyDisplay?: NumberFormatOptionsCurrencyDisplay | undefined; + useGrouping?: NumberFormatOptionsUseGrouping | undefined; minimumIntegerDigits?: number | undefined; minimumFractionDigits?: number | undefined; maximumFractionDigits?: number | undefined; @@ -4449,14 +4470,15 @@ declare namespace Intl { interface ResolvedNumberFormatOptions { locale: string; numberingSystem: string; - style: string; + style: NumberFormatOptionsStyle; currency?: string; + currencyDisplay?: NumberFormatOptionsCurrencyDisplay; minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; + minimumFractionDigits?: number; + maximumFractionDigits?: number; minimumSignificantDigits?: number; maximumSignificantDigits?: number; - useGrouping: boolean; + useGrouping: ResolvedNumberFormatOptionsUseGrouping; } interface NumberFormat { diff --git a/cli/tsc/dts/lib.esnext.array.d.ts b/cli/tsc/dts/lib.esnext.array.d.ts index bcf6fb62c..39efbba0d 100644 --- a/cli/tsc/dts/lib.esnext.array.d.ts +++ b/cli/tsc/dts/lib.esnext.array.d.ts @@ -13,18 +13,23 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ + /// <reference no-default-lib="true"/> -// NOTE(bartlomieju): taken from https://github.com/microsoft/TypeScript/issues/50803#issuecomment-1249030430 -// while we wait for these types to officially ship interface ArrayConstructor { - fromAsync<T>( - iterableOrArrayLike: AsyncIterable<T> | Iterable<T | Promise<T>> | ArrayLike<T | Promise<T>>, - ): Promise<T[]>; - - fromAsync<T, U>( - iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, - mapFn: (value: Awaited<T>) => U, - thisArg?: any, - ): Promise<Awaited<U>[]>; + /** + * Creates an array from an async iterator or iterable object. + * @param iterableOrArrayLike An async iterator or array-like object to convert to an array. + */ + fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>; + + /** + * Creates an array from an async iterator or iterable object. + * + * @param iterableOrArrayLike An async iterator or array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of itarableOrArrayLike. + * Each return value is awaited before being added to result array. + * @param thisArg Value of 'this' used when executing mapfn. + */ + fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>) => U, thisArg?: any): Promise<Awaited<U>[]>; } diff --git a/cli/tsc/dts/lib.esnext.collection.d.ts b/cli/tsc/dts/lib.esnext.collection.d.ts index 834b1a6b1..1278a38f6 100644 --- a/cli/tsc/dts/lib.esnext.collection.d.ts +++ b/cli/tsc/dts/lib.esnext.collection.d.ts @@ -28,33 +28,79 @@ interface MapConstructor { ): Map<K, T[]>; } +interface ReadonlySetLike<T> { + /** + * Despite its name, returns an iterator of the values in the set-like. + */ + keys(): Iterator<T>; + /** + * @returns a boolean indicating whether an element with the specified value exists in the set-like or not. + */ + has(value: T): boolean; + /** + * @returns the number of (unique) elements in the set-like. + */ + readonly size: number; +} + interface Set<T> { /** * @returns a new Set containing all the elements in this Set and also all the elements in the argument. */ - union<U>(other: Set<U>): Set<T | U>; + union<U>(other: ReadonlySetLike<U>): Set<T | U>; + /** + * @returns a new Set containing all the elements which are both in this Set and in the argument. + */ + intersection<U>(other: ReadonlySetLike<U>): Set<T & U>; + /** + * @returns a new Set containing all the elements in this Set which are not also in the argument. + */ + difference<U>(other: ReadonlySetLike<U>): Set<T>; + /** + * @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both. + */ + symmetricDifference<U>(other: ReadonlySetLike<U>): Set<T | U>; + /** + * @returns a boolean indicating whether all the elements in this Set are also in the argument. + */ + isSubsetOf(other: ReadonlySetLike<unknown>): boolean; + /** + * @returns a boolean indicating whether all the elements in the argument are also in this Set. + */ + isSupersetOf(other: ReadonlySetLike<unknown>): boolean; + /** + * @returns a boolean indicating whether this Set has no elements in common with the argument. + */ + isDisjointFrom(other: ReadonlySetLike<unknown>): boolean; +} + +interface ReadonlySet<T> { + /** + * @returns a new Set containing all the elements in this Set and also all the elements in the argument. + */ + union<U>(other: ReadonlySetLike<U>): Set<T | U>; /** * @returns a new Set containing all the elements which are both in this Set and in the argument. */ - intersection<U>(other: Set<U>): Set<T & U>; + intersection<U>(other: ReadonlySetLike<U>): Set<T & U>; /** * @returns a new Set containing all the elements in this Set which are not also in the argument. */ - difference<U>(other: Set<U>): Set<T>; + difference<U>(other: ReadonlySetLike<U>): Set<T>; /** * @returns a new Set containing all the elements which are in either this Set or in the argument, but not in both. */ - symmetricDifference<U>(other: Set<U>): Set<T | U>; + symmetricDifference<U>(other: ReadonlySetLike<U>): Set<T | U>; /** * @returns a boolean indicating whether all the elements in this Set are also in the argument. */ - isSubsetOf(other: Set<unknown>): boolean; + isSubsetOf(other: ReadonlySetLike<unknown>): boolean; /** * @returns a boolean indicating whether all the elements in the argument are also in this Set. */ - isSupersetOf(other: Set<unknown>): boolean; + isSupersetOf(other: ReadonlySetLike<unknown>): boolean; /** * @returns a boolean indicating whether this Set has no elements in common with the argument. */ - isDisjointFrom(other: Set<unknown>): boolean; + isDisjointFrom(other: ReadonlySetLike<unknown>): boolean; } diff --git a/cli/tsc/dts/lib.esnext.d.ts b/cli/tsc/dts/lib.esnext.d.ts index 63b388aba..a2912fe3d 100644 --- a/cli/tsc/dts/lib.esnext.d.ts +++ b/cli/tsc/dts/lib.esnext.d.ts @@ -17,11 +17,12 @@ and limitations under the License. /// <reference no-default-lib="true"/> /// <reference lib="es2023" /> -/// <reference lib="esnext.array" /> /// <reference lib="esnext.intl" /> -/// <reference lib="esnext.object" /> /// <reference lib="esnext.decorators" /> /// <reference lib="esnext.disposable" /> /// <reference lib="esnext.promise" /> /// <reference lib="esnext.object" /> /// <reference lib="esnext.collection" /> +/// <reference lib="esnext.array" /> +/// <reference lib="esnext.regexp" /> +/// <reference lib="esnext.string" /> diff --git a/cli/tsc/dts/lib.esnext.intl.d.ts b/cli/tsc/dts/lib.esnext.intl.d.ts index c02e8b816..71b72acc8 100644 --- a/cli/tsc/dts/lib.esnext.intl.d.ts +++ b/cli/tsc/dts/lib.esnext.intl.d.ts @@ -17,12 +17,5 @@ and limitations under the License. /// <reference no-default-lib="true"/> declare namespace Intl { - interface NumberRangeFormatPart extends NumberFormatPart { - source: "startRange" | "endRange" | "shared"; - } - - interface NumberFormat { - formatRange(start: number | bigint, end: number | bigint): string; - formatRangeToParts(start: number | bigint, end: number | bigint): NumberRangeFormatPart[]; - } + // Empty } diff --git a/cli/tsc/dts/lib.esnext.regexp.d.ts b/cli/tsc/dts/lib.esnext.regexp.d.ts new file mode 100644 index 000000000..d660eab81 --- /dev/null +++ b/cli/tsc/dts/lib.esnext.regexp.d.ts @@ -0,0 +1,25 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// <reference no-default-lib="true"/> + +interface RegExp { + /** + * Returns a Boolean value indicating the state of the unicodeSets flag (v) used with a regular expression. + * Default is false. Read-only. + */ + readonly unicodeSets: boolean; +} diff --git a/cli/tsc/dts/lib.esnext.string.d.ts b/cli/tsc/dts/lib.esnext.string.d.ts new file mode 100644 index 000000000..faea82c97 --- /dev/null +++ b/cli/tsc/dts/lib.esnext.string.d.ts @@ -0,0 +1,29 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + +/// <reference no-default-lib="true"/> + +interface String { + /** + * Returns true if all leading surrogates and trailing surrogates appear paired and in order. + */ + isWellFormed(): boolean; + + /** + * Returns a string where all lone or out-of-order surrogates have been replaced by the Unicode replacement character (U+FFFD). + */ + toWellFormed(): string; +} diff --git a/cli/tsc/dts/lib.webworker.asynciterable.d.ts b/cli/tsc/dts/lib.webworker.asynciterable.d.ts index 421a6b9dc..86de21097 100644 --- a/cli/tsc/dts/lib.webworker.asynciterable.d.ts +++ b/cli/tsc/dts/lib.webworker.asynciterable.d.ts @@ -26,3 +26,8 @@ interface FileSystemDirectoryHandle { keys(): AsyncIterableIterator<string>; values(): AsyncIterableIterator<FileSystemHandle>; } + +interface ReadableStream<R = any> { + [Symbol.asyncIterator](options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; + values(options?: ReadableStreamIteratorOptions): AsyncIterableIterator<R>; +} diff --git a/cli/tsc/dts/lib.webworker.d.ts b/cli/tsc/dts/lib.webworker.d.ts index 3f722c1b0..5a1868e15 100644 --- a/cli/tsc/dts/lib.webworker.d.ts +++ b/cli/tsc/dts/lib.webworker.d.ts @@ -550,6 +550,17 @@ interface ReadableStreamGetReaderOptions { mode?: ReadableStreamReaderMode; } +interface ReadableStreamIteratorOptions { + /** + * Asynchronously iterates over the chunks in the stream's internal queue. + * + * Asynchronously iterating over the stream will lock it, preventing any other consumer from acquiring a reader. The lock will be released if the async iterator's return() method is called, e.g. by breaking out of the loop. + * + * By default, calling the async iterator's return() method will also cancel the stream. To prevent this, use the stream's values() method, passing true for the preventCancel option. + */ + preventCancel?: boolean; +} + interface ReadableStreamReadDoneResult<T> { done: true; value?: T; @@ -647,16 +658,16 @@ interface RsaPssParams extends Algorithm { interface SecurityPolicyViolationEventInit extends EventInit { blockedURI?: string; columnNumber?: number; - disposition: SecurityPolicyViolationEventDisposition; - documentURI: string; - effectiveDirective: string; + disposition?: SecurityPolicyViolationEventDisposition; + documentURI?: string; + effectiveDirective?: string; lineNumber?: number; - originalPolicy: string; + originalPolicy?: string; referrer?: string; sample?: string; sourceFile?: string; - statusCode: number; - violatedDirective: string; + statusCode?: number; + violatedDirective?: string; } interface StorageEstimate { @@ -971,6 +982,8 @@ declare var AbortSignal: { new(): AbortSignal; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_static) */ abort(reason?: any): AbortSignal; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */ + any(signals: AbortSignal[]): AbortSignal; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout_static) */ timeout(milliseconds: number): AbortSignal; }; @@ -5225,6 +5238,7 @@ interface ServiceWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap { /** * This ServiceWorker API interface represents the global execution context of a service worker. + * Available only in secure contexts. * * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope) */ diff --git a/cli/tsc/dts/lib.webworker.iterable.d.ts b/cli/tsc/dts/lib.webworker.iterable.d.ts index 54f5528b2..4f53ad5e0 100644 --- a/cli/tsc/dts/lib.webworker.iterable.d.ts +++ b/cli/tsc/dts/lib.webworker.iterable.d.ts @@ -20,6 +20,11 @@ and limitations under the License. /// Worker Iterable APIs ///////////////////////////// +interface AbortSignal { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/any_static) */ + any(signals: Iterable<AbortSignal>): AbortSignal; +} + interface CSSNumericArray { [Symbol.iterator](): IterableIterator<CSSNumericValue>; entries(): IterableIterator<[number, CSSNumericValue]>; diff --git a/cli/tsc/dts/typescript.d.ts b/cli/tsc/dts/typescript.d.ts index 3cf955e29..882767d3c 100644 --- a/cli/tsc/dts/typescript.d.ts +++ b/cli/tsc/dts/typescript.d.ts @@ -15,92 +15,38 @@ and limitations under the License. declare namespace ts { namespace server { - type ActionSet = "action::set"; - type ActionInvalidate = "action::invalidate"; - type ActionPackageInstalled = "action::packageInstalled"; - type EventTypesRegistry = "event::typesRegistry"; - type EventBeginInstallTypes = "event::beginInstallTypes"; - type EventEndInstallTypes = "event::endInstallTypes"; - type EventInitializationFailed = "event::initializationFailed"; - type ActionWatchTypingLocations = "action::watchTypingLocations"; - interface TypingInstallerResponse { - readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed | ActionWatchTypingLocations; - } - interface TypingInstallerRequestWithProjectName { - readonly projectName: string; - } - interface DiscoverTypings extends TypingInstallerRequestWithProjectName { - readonly fileNames: string[]; - readonly projectRootPath: Path; - readonly compilerOptions: CompilerOptions; - readonly typeAcquisition: TypeAcquisition; - readonly unresolvedImports: SortedReadonlyArray<string>; - readonly cachePath?: string; - readonly kind: "discover"; - } - interface CloseProject extends TypingInstallerRequestWithProjectName { - readonly kind: "closeProject"; - } - interface TypesRegistryRequest { - readonly kind: "typesRegistry"; - } - interface InstallPackageRequest extends TypingInstallerRequestWithProjectName { - readonly kind: "installPackage"; - readonly fileName: Path; - readonly packageName: string; - readonly projectRootPath: Path; - readonly id: number; - } - interface PackageInstalledResponse extends ProjectResponse { - readonly kind: ActionPackageInstalled; - readonly id: number; - readonly success: boolean; - readonly message: string; - } - interface InitializationFailedResponse extends TypingInstallerResponse { - readonly kind: EventInitializationFailed; - readonly message: string; - readonly stack?: string; - } - interface ProjectResponse extends TypingInstallerResponse { - readonly projectName: string; - } - interface InvalidateCachedTypings extends ProjectResponse { - readonly kind: ActionInvalidate; - } - interface InstallTypes extends ProjectResponse { - readonly kind: EventBeginInstallTypes | EventEndInstallTypes; - readonly eventId: number; - readonly typingsInstallerVersion: string; - readonly packagesToInstall: readonly string[]; - } - interface BeginInstallTypes extends InstallTypes { - readonly kind: EventBeginInstallTypes; - } - interface EndInstallTypes extends InstallTypes { - readonly kind: EventEndInstallTypes; - readonly installSuccess: boolean; - } - interface InstallTypingHost extends JsTyping.TypingResolutionHost { - useCaseSensitiveFileNames: boolean; - writeFile(path: string, content: string): void; - createDirectory(path: string): void; - getCurrentDirectory?(): string; - } - interface SetTypings extends ProjectResponse { - readonly typeAcquisition: TypeAcquisition; - readonly compilerOptions: CompilerOptions; - readonly typings: string[]; - readonly unresolvedImports: SortedReadonlyArray<string>; - readonly kind: ActionSet; - } - interface WatchTypingLocations extends ProjectResponse { - /** if files is undefined, retain same set of watchers */ - readonly files: readonly string[] | undefined; - readonly kind: ActionWatchTypingLocations; - } namespace protocol { - enum CommandTypes { + export import ApplicableRefactorInfo = ts.ApplicableRefactorInfo; + export import ClassificationType = ts.ClassificationType; + export import CompletionsTriggerCharacter = ts.CompletionsTriggerCharacter; + export import CompletionTriggerKind = ts.CompletionTriggerKind; + export import InlayHintKind = ts.InlayHintKind; + export import OrganizeImportsMode = ts.OrganizeImportsMode; + export import RefactorActionInfo = ts.RefactorActionInfo; + export import RefactorTriggerReason = ts.RefactorTriggerReason; + export import RenameInfoFailure = ts.RenameInfoFailure; + export import SemicolonPreference = ts.SemicolonPreference; + export import SignatureHelpCharacterTypedReason = ts.SignatureHelpCharacterTypedReason; + export import SignatureHelpInvokedReason = ts.SignatureHelpInvokedReason; + export import SignatureHelpParameter = ts.SignatureHelpParameter; + export import SignatureHelpRetriggerCharacter = ts.SignatureHelpRetriggerCharacter; + export import SignatureHelpRetriggeredReason = ts.SignatureHelpRetriggeredReason; + export import SignatureHelpTriggerCharacter = ts.SignatureHelpTriggerCharacter; + export import SignatureHelpTriggerReason = ts.SignatureHelpTriggerReason; + export import SymbolDisplayPart = ts.SymbolDisplayPart; + export import UserPreferences = ts.UserPreferences; + type ChangePropertyTypes< + T, + Substitutions extends { + [K in keyof T]?: any; + }, + > = { + [K in keyof T]: K extends keyof Substitutions ? Substitutions[K] : T[K]; + }; + type ChangeStringIndexSignature<T, NewStringIndexSignatureType> = { + [K in keyof T]: string extends K ? NewStringIndexSignatureType : T[K]; + }; + export enum CommandTypes { JsxClosingTag = "jsxClosingTag", LinkedEditingRange = "linkedEditingRange", Brace = "brace", @@ -161,6 +107,7 @@ declare namespace ts { GetApplicableRefactors = "getApplicableRefactors", GetEditsForRefactor = "getEditsForRefactor", GetMoveToRefactoringFileSuggestions = "getMoveToRefactoringFileSuggestions", + GetPasteEdits = "getPasteEdits", OrganizeImports = "organizeImports", GetEditsForFileRename = "getEditsForFileRename", ConfigurePlugin = "configurePlugin", @@ -174,11 +121,12 @@ declare namespace ts { ProvideCallHierarchyOutgoingCalls = "provideCallHierarchyOutgoingCalls", ProvideInlayHints = "provideInlayHints", WatchChange = "watchChange", + MapCode = "mapCode", } /** * A TypeScript Server message */ - interface Message { + export interface Message { /** * Sequence number of the message */ @@ -191,7 +139,7 @@ declare namespace ts { /** * Client-initiated request message */ - interface Request extends Message { + export interface Request extends Message { type: "request"; /** * The command to execute @@ -205,13 +153,13 @@ declare namespace ts { /** * Request to reload the project structure for all the opened files */ - interface ReloadProjectsRequest extends Request { + export interface ReloadProjectsRequest extends Request { command: CommandTypes.ReloadProjects; } /** * Server-initiated event message */ - interface Event extends Message { + export interface Event extends Message { type: "event"; /** * Name of event @@ -225,7 +173,7 @@ declare namespace ts { /** * Response by server to client request message. */ - interface Response extends Message { + export interface Response extends Message { type: "response"; /** * Sequence number of the request message. @@ -257,7 +205,7 @@ declare namespace ts { */ performanceData?: PerformanceData; } - interface PerformanceData { + export interface PerformanceData { /** * Time spent updating the program graph, in milliseconds. */ @@ -270,17 +218,17 @@ declare namespace ts { /** * Arguments for FileRequest messages. */ - interface FileRequestArgs { + export interface FileRequestArgs { /** * The file for the request (absolute pathname required). */ file: string; projectFileName?: string; } - interface StatusRequest extends Request { + export interface StatusRequest extends Request { command: CommandTypes.Status; } - interface StatusResponseBody { + export interface StatusResponseBody { /** * The TypeScript version (`ts.version`). */ @@ -289,32 +237,32 @@ declare namespace ts { /** * Response to StatusRequest */ - interface StatusResponse extends Response { + export interface StatusResponse extends Response { body: StatusResponseBody; } /** * Requests a JS Doc comment template for a given position */ - interface DocCommentTemplateRequest extends FileLocationRequest { + export interface DocCommentTemplateRequest extends FileLocationRequest { command: CommandTypes.DocCommentTemplate; } /** * Response to DocCommentTemplateRequest */ - interface DocCommandTemplateResponse extends Response { + export interface DocCommandTemplateResponse extends Response { body?: TextInsertion; } /** * A request to get TODO comments from the file */ - interface TodoCommentRequest extends FileRequest { + export interface TodoCommentRequest extends FileRequest { command: CommandTypes.TodoComments; arguments: TodoCommentRequestArgs; } /** * Arguments for TodoCommentRequest request. */ - interface TodoCommentRequestArgs extends FileRequestArgs { + export interface TodoCommentRequestArgs extends FileRequestArgs { /** * Array of target TodoCommentDescriptors that describes TODO comments to be found */ @@ -323,17 +271,17 @@ declare namespace ts { /** * Response for TodoCommentRequest request. */ - interface TodoCommentsResponse extends Response { + export interface TodoCommentsResponse extends Response { body?: TodoComment[]; } /** * A request to determine if the caret is inside a comment. */ - interface SpanOfEnclosingCommentRequest extends FileLocationRequest { + export interface SpanOfEnclosingCommentRequest extends FileLocationRequest { command: CommandTypes.GetSpanOfEnclosingComment; arguments: SpanOfEnclosingCommentRequestArgs; } - interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs { + export interface SpanOfEnclosingCommentRequestArgs extends FileLocationRequestArgs { /** * Requires that the enclosing span be a multi-line comment, or else the request returns undefined. */ @@ -342,49 +290,36 @@ declare namespace ts { /** * Request to obtain outlining spans in file. */ - interface OutliningSpansRequest extends FileRequest { + export interface OutliningSpansRequest extends FileRequest { command: CommandTypes.GetOutliningSpans; } - interface OutliningSpan { - /** The span of the document to actually collapse. */ + export type OutliningSpan = ChangePropertyTypes<ts.OutliningSpan, { textSpan: TextSpan; - /** The span of the document to display when the user hovers over the collapsed span. */ hintSpan: TextSpan; - /** The text to display in the editor for the collapsed region. */ - bannerText: string; - /** - * Whether or not this region should be automatically collapsed when - * the 'Collapse to Definitions' command is invoked. - */ - autoCollapse: boolean; - /** - * Classification of the contents of the span - */ - kind: OutliningSpanKind; - } + }>; /** * Response to OutliningSpansRequest request. */ - interface OutliningSpansResponse extends Response { + export interface OutliningSpansResponse extends Response { body?: OutliningSpan[]; } /** * A request to get indentation for a location in file */ - interface IndentationRequest extends FileLocationRequest { + export interface IndentationRequest extends FileLocationRequest { command: CommandTypes.Indentation; arguments: IndentationRequestArgs; } /** * Response for IndentationRequest request. */ - interface IndentationResponse extends Response { + export interface IndentationResponse extends Response { body?: IndentationResult; } /** * Indentation result representing where indentation should be placed */ - interface IndentationResult { + export interface IndentationResult { /** * The base position in the document that the indent should be relative to */ @@ -397,7 +332,7 @@ declare namespace ts { /** * Arguments for IndentationRequest request. */ - interface IndentationRequestArgs extends FileLocationRequestArgs { + export interface IndentationRequestArgs extends FileLocationRequestArgs { /** * An optional set of settings to be used when computing indentation. * If argument is omitted - then it will use settings for file that were previously set via 'configure' request or global settings. @@ -407,7 +342,7 @@ declare namespace ts { /** * Arguments for ProjectInfoRequest request. */ - interface ProjectInfoRequestArgs extends FileRequestArgs { + export interface ProjectInfoRequestArgs extends FileRequestArgs { /** * Indicate if the file name list of the project is needed */ @@ -416,20 +351,20 @@ declare namespace ts { /** * A request to get the project information of the current file. */ - interface ProjectInfoRequest extends Request { + export interface ProjectInfoRequest extends Request { command: CommandTypes.ProjectInfo; arguments: ProjectInfoRequestArgs; } /** * A request to retrieve compiler options diagnostics for a project */ - interface CompilerOptionsDiagnosticsRequest extends Request { + export interface CompilerOptionsDiagnosticsRequest extends Request { arguments: CompilerOptionsDiagnosticsRequestArgs; } /** * Arguments for CompilerOptionsDiagnosticsRequest request. */ - interface CompilerOptionsDiagnosticsRequestArgs { + export interface CompilerOptionsDiagnosticsRequestArgs { /** * Name of the project to retrieve compiler options diagnostics. */ @@ -438,7 +373,7 @@ declare namespace ts { /** * Response message body for "projectInfo" request */ - interface ProjectInfo { + export interface ProjectInfo { /** * For configured project, this is the normalized path of the 'tsconfig.json' file * For inferred project, this is undefined @@ -458,7 +393,7 @@ declare namespace ts { * - start position and length of the error span * - startLocation and endLocation - a pair of Location objects that store start/end line and offset of the error span. */ - interface DiagnosticWithLinePosition { + export interface DiagnosticWithLinePosition { message: string; start: number; length: number; @@ -474,20 +409,20 @@ declare namespace ts { /** * Response message for "projectInfo" request */ - interface ProjectInfoResponse extends Response { + export interface ProjectInfoResponse extends Response { body?: ProjectInfo; } /** * Request whose sole parameter is a file name. */ - interface FileRequest extends Request { + export interface FileRequest extends Request { arguments: FileRequestArgs; } /** * Instances of this interface specify a location in a source file: * (file, line, character offset), where line and character offset are 1-based. */ - interface FileLocationRequestArgs extends FileRequestArgs { + export interface FileLocationRequestArgs extends FileRequestArgs { /** * The line number for the request (1-based). */ @@ -497,15 +432,15 @@ declare namespace ts { */ offset: number; } - type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs; + export type FileLocationOrRangeRequestArgs = FileLocationRequestArgs | FileRangeRequestArgs; /** * Request refactorings at a given position or selection area. */ - interface GetApplicableRefactorsRequest extends Request { + export interface GetApplicableRefactorsRequest extends Request { command: CommandTypes.GetApplicableRefactors; arguments: GetApplicableRefactorsRequestArgs; } - type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & { + export type GetApplicableRefactorsRequestArgs = FileLocationOrRangeRequestArgs & { triggerReason?: RefactorTriggerReason; kind?: string; /** @@ -517,88 +452,61 @@ declare namespace ts { */ includeInteractiveActions?: boolean; }; - type RefactorTriggerReason = "implicit" | "invoked"; /** * Response is a list of available refactorings. * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring */ - interface GetApplicableRefactorsResponse extends Response { + export interface GetApplicableRefactorsResponse extends Response { body?: ApplicableRefactorInfo[]; } /** * Request refactorings at a given position or selection area to move to an existing file. */ - interface GetMoveToRefactoringFileSuggestionsRequest extends Request { + export interface GetMoveToRefactoringFileSuggestionsRequest extends Request { command: CommandTypes.GetMoveToRefactoringFileSuggestions; arguments: GetMoveToRefactoringFileSuggestionsRequestArgs; } - type GetMoveToRefactoringFileSuggestionsRequestArgs = FileLocationOrRangeRequestArgs & { + export type GetMoveToRefactoringFileSuggestionsRequestArgs = FileLocationOrRangeRequestArgs & { kind?: string; }; /** * Response is a list of available files. * Each refactoring exposes one or more "Actions"; a user selects one action to invoke a refactoring */ - interface GetMoveToRefactoringFileSuggestions extends Response { + export interface GetMoveToRefactoringFileSuggestions extends Response { body: { newFileName: string; files: string[]; }; } /** - * A set of one or more available refactoring actions, grouped under a parent refactoring. + * Request refactorings at a given position post pasting text from some other location. */ - interface ApplicableRefactorInfo { - /** - * The programmatic name of the refactoring - */ - name: string; - /** - * A description of this refactoring category to show to the user. - * If the refactoring gets inlined (see below), this text will not be visible. - */ - description: string; - /** - * Inlineable refactorings can have their actions hoisted out to the top level - * of a context menu. Non-inlineanable refactorings should always be shown inside - * their parent grouping. - * - * If not specified, this value is assumed to be 'true' - */ - inlineable?: boolean; - actions: RefactorActionInfo[]; + export interface GetPasteEditsRequest extends Request { + command: CommandTypes.GetPasteEdits; + arguments: GetPasteEditsRequestArgs; } - /** - * Represents a single refactoring action - for example, the "Extract Method..." refactor might - * offer several actions, each corresponding to a surround class or closure to extract into. - */ - interface RefactorActionInfo { - /** - * The programmatic name of the refactoring action + export interface GetPasteEditsRequestArgs extends FileRequestArgs { + /** The text that gets pasted in a file. */ + pastedText: string[]; + /** Locations of where the `pastedText` gets added in a file. If the length of the `pastedText` and `pastedLocations` are not the same, + * then the `pastedText` is combined into one and added at all the `pastedLocations`. */ - name: string; - /** - * A description of this refactoring action to show to the user. - * If the parent refactoring is inlined away, this will be the only text shown, - * so this description should make sense by itself if the parent is inlineable=true - */ - description: string; - /** - * A message to show to the user if the refactoring cannot be applied in - * the current context. - */ - notApplicableReason?: string; - /** - * The hierarchical dotted name of the refactor action. - */ - kind?: string; - /** - * Indicates that the action requires additional arguments to be passed - * when calling 'GetEditsForRefactor'. - */ - isInteractive?: boolean; + pasteLocations: TextSpan[]; + /** The source location of each `pastedText`. If present, the length of `spans` must be equal to the length of `pastedText`. */ + copiedFrom?: { + file: string; + spans: TextSpan[]; + }; + } + export interface GetPasteEditsResponse extends Response { + body: PasteEditsAction; } - interface GetEditsForRefactorRequest extends Request { + export interface PasteEditsAction { + edits: FileCodeEdits[]; + fixId?: {}; + } + export interface GetEditsForRefactorRequest extends Request { command: CommandTypes.GetEditsForRefactor; arguments: GetEditsForRefactorRequestArgs; } @@ -606,15 +514,15 @@ declare namespace ts { * Request the edits that a particular refactoring action produces. * Callers must specify the name of the refactor and the name of the action. */ - type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & { + export type GetEditsForRefactorRequestArgs = FileLocationOrRangeRequestArgs & { refactor: string; action: string; interactiveRefactorArguments?: InteractiveRefactorArguments; }; - interface GetEditsForRefactorResponse extends Response { + export interface GetEditsForRefactorResponse extends Response { body?: RefactorEditInfo; } - interface RefactorEditInfo { + export interface RefactorEditInfo { edits: FileCodeEdits[]; /** * An optional location where the editor should start a rename operation once @@ -630,58 +538,53 @@ declare namespace ts { * 2) Coalescing imports from the same module * 3) Sorting imports */ - interface OrganizeImportsRequest extends Request { + export interface OrganizeImportsRequest extends Request { command: CommandTypes.OrganizeImports; arguments: OrganizeImportsRequestArgs; } - type OrganizeImportsScope = GetCombinedCodeFixScope; - enum OrganizeImportsMode { - All = "All", - SortAndCombine = "SortAndCombine", - RemoveUnused = "RemoveUnused", - } - interface OrganizeImportsRequestArgs { + export type OrganizeImportsScope = GetCombinedCodeFixScope; + export interface OrganizeImportsRequestArgs { scope: OrganizeImportsScope; /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; mode?: OrganizeImportsMode; } - interface OrganizeImportsResponse extends Response { + export interface OrganizeImportsResponse extends Response { body: readonly FileCodeEdits[]; } - interface GetEditsForFileRenameRequest extends Request { + export interface GetEditsForFileRenameRequest extends Request { command: CommandTypes.GetEditsForFileRename; arguments: GetEditsForFileRenameRequestArgs; } /** Note: Paths may also be directories. */ - interface GetEditsForFileRenameRequestArgs { + export interface GetEditsForFileRenameRequestArgs { readonly oldFilePath: string; readonly newFilePath: string; } - interface GetEditsForFileRenameResponse extends Response { + export interface GetEditsForFileRenameResponse extends Response { body: readonly FileCodeEdits[]; } /** * Request for the available codefixes at a specific position. */ - interface CodeFixRequest extends Request { + export interface CodeFixRequest extends Request { command: CommandTypes.GetCodeFixes; arguments: CodeFixRequestArgs; } - interface GetCombinedCodeFixRequest extends Request { + export interface GetCombinedCodeFixRequest extends Request { command: CommandTypes.GetCombinedCodeFix; arguments: GetCombinedCodeFixRequestArgs; } - interface GetCombinedCodeFixResponse extends Response { + export interface GetCombinedCodeFixResponse extends Response { body: CombinedCodeActions; } - interface ApplyCodeActionCommandRequest extends Request { + export interface ApplyCodeActionCommandRequest extends Request { command: CommandTypes.ApplyCodeActionCommand; arguments: ApplyCodeActionCommandRequestArgs; } - interface ApplyCodeActionCommandResponse extends Response { + export interface ApplyCodeActionCommandResponse extends Response { } - interface FileRangeRequestArgs extends FileRequestArgs { + export interface FileRangeRequestArgs extends FileRequestArgs { /** * The line number for the request (1-based). */ @@ -702,47 +605,47 @@ declare namespace ts { /** * Instances of this interface specify errorcodes on a specific location in a sourcefile. */ - interface CodeFixRequestArgs extends FileRangeRequestArgs { + export interface CodeFixRequestArgs extends FileRangeRequestArgs { /** * Errorcodes we want to get the fixes for. */ errorCodes: readonly number[]; } - interface GetCombinedCodeFixRequestArgs { + export interface GetCombinedCodeFixRequestArgs { scope: GetCombinedCodeFixScope; fixId: {}; } - interface GetCombinedCodeFixScope { + export interface GetCombinedCodeFixScope { type: "file"; args: FileRequestArgs; } - interface ApplyCodeActionCommandRequestArgs { + export interface ApplyCodeActionCommandRequestArgs { /** May also be an array of commands. */ command: {}; } /** * Response for GetCodeFixes request. */ - interface GetCodeFixesResponse extends Response { + export interface GetCodeFixesResponse extends Response { body?: CodeAction[]; } /** * A request whose arguments specify a file location (file, line, col). */ - interface FileLocationRequest extends FileRequest { + export interface FileLocationRequest extends FileRequest { arguments: FileLocationRequestArgs; } /** * A request to get codes of supported code fixes. */ - interface GetSupportedCodeFixesRequest extends Request { + export interface GetSupportedCodeFixesRequest extends Request { command: CommandTypes.GetSupportedCodeFixes; arguments?: Partial<FileRequestArgs>; } /** * A response for GetSupportedCodeFixesRequest request. */ - interface GetSupportedCodeFixesResponse extends Response { + export interface GetSupportedCodeFixesResponse extends Response { /** * List of error codes supported by the server. */ @@ -751,13 +654,13 @@ declare namespace ts { /** * A request to get encoded semantic classifications for a span in the file */ - interface EncodedSemanticClassificationsRequest extends FileRequest { + export interface EncodedSemanticClassificationsRequest extends FileRequest { arguments: EncodedSemanticClassificationsRequestArgs; } /** * Arguments for EncodedSemanticClassificationsRequest request. */ - interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { + export interface EncodedSemanticClassificationsRequestArgs extends FileRequestArgs { /** * Start position of the span. */ @@ -773,13 +676,13 @@ declare namespace ts { format?: "original" | "2020"; } /** The response for a EncodedSemanticClassificationsRequest */ - interface EncodedSemanticClassificationsResponse extends Response { + export interface EncodedSemanticClassificationsResponse extends Response { body?: EncodedSemanticClassificationsResponseBody; } /** * Implementation response message. Gives series of text spans depending on the format ar. */ - interface EncodedSemanticClassificationsResponseBody { + export interface EncodedSemanticClassificationsResponseBody { endOfLineState: EndOfLineState; spans: number[]; } @@ -787,7 +690,7 @@ declare namespace ts { * Arguments in document highlight request; include: filesToSearch, file, * line, offset. */ - interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { + export interface DocumentHighlightsRequestArgs extends FileLocationRequestArgs { /** * List of files to search for document highlights. */ @@ -798,16 +701,16 @@ declare namespace ts { * "definition". Return response giving the file locations that * define the symbol found in file at location line, col. */ - interface DefinitionRequest extends FileLocationRequest { + export interface DefinitionRequest extends FileLocationRequest { command: CommandTypes.Definition; } - interface DefinitionAndBoundSpanRequest extends FileLocationRequest { + export interface DefinitionAndBoundSpanRequest extends FileLocationRequest { readonly command: CommandTypes.DefinitionAndBoundSpan; } - interface FindSourceDefinitionRequest extends FileLocationRequest { + export interface FindSourceDefinitionRequest extends FileLocationRequest { readonly command: CommandTypes.FindSourceDefinition; } - interface DefinitionAndBoundSpanResponse extends Response { + export interface DefinitionAndBoundSpanResponse extends Response { readonly body: DefinitionInfoAndBoundSpan; } /** @@ -815,7 +718,7 @@ declare namespace ts { * "typeDefinition". Return response giving the file locations that * define the type for the symbol found in file at location line, col. */ - interface TypeDefinitionRequest extends FileLocationRequest { + export interface TypeDefinitionRequest extends FileLocationRequest { command: CommandTypes.TypeDefinition; } /** @@ -823,20 +726,20 @@ declare namespace ts { * "implementation". Return response giving the file locations that * implement the symbol found in file at location line, col. */ - interface ImplementationRequest extends FileLocationRequest { + export interface ImplementationRequest extends FileLocationRequest { command: CommandTypes.Implementation; } /** * Location in source code expressed as (one-based) line and (one-based) column offset. */ - interface Location { + export interface Location { line: number; offset: number; } /** * Object found in response messages defining a span of text in source code. */ - interface TextSpan { + export interface TextSpan { /** * First character of the definition. */ @@ -849,13 +752,13 @@ declare namespace ts { /** * Object found in response messages defining a span of text in a specific source file. */ - interface FileSpan extends TextSpan { + export interface FileSpan extends TextSpan { /** * File containing text span. */ file: string; } - interface JSDocTagInfo { + export interface JSDocTagInfo { /** Name of the JSDoc tag */ name: string; /** @@ -864,78 +767,78 @@ declare namespace ts { */ text?: string | SymbolDisplayPart[]; } - interface TextSpanWithContext extends TextSpan { + export interface TextSpanWithContext extends TextSpan { contextStart?: Location; contextEnd?: Location; } - interface FileSpanWithContext extends FileSpan, TextSpanWithContext { + export interface FileSpanWithContext extends FileSpan, TextSpanWithContext { } - interface DefinitionInfo extends FileSpanWithContext { + export interface DefinitionInfo extends FileSpanWithContext { /** * When true, the file may or may not exist. */ unverified?: boolean; } - interface DefinitionInfoAndBoundSpan { + export interface DefinitionInfoAndBoundSpan { definitions: readonly DefinitionInfo[]; textSpan: TextSpan; } /** * Definition response message. Gives text range for definition. */ - interface DefinitionResponse extends Response { + export interface DefinitionResponse extends Response { body?: DefinitionInfo[]; } - interface DefinitionInfoAndBoundSpanResponse extends Response { + export interface DefinitionInfoAndBoundSpanResponse extends Response { body?: DefinitionInfoAndBoundSpan; } /** @deprecated Use `DefinitionInfoAndBoundSpanResponse` instead. */ - type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse; + export type DefinitionInfoAndBoundSpanReponse = DefinitionInfoAndBoundSpanResponse; /** * Definition response message. Gives text range for definition. */ - interface TypeDefinitionResponse extends Response { + export interface TypeDefinitionResponse extends Response { body?: FileSpanWithContext[]; } /** * Implementation response message. Gives text range for implementations. */ - interface ImplementationResponse extends Response { + export interface ImplementationResponse extends Response { body?: FileSpanWithContext[]; } /** * Request to get brace completion for a location in the file. */ - interface BraceCompletionRequest extends FileLocationRequest { + export interface BraceCompletionRequest extends FileLocationRequest { command: CommandTypes.BraceCompletion; arguments: BraceCompletionRequestArgs; } /** * Argument for BraceCompletionRequest request. */ - interface BraceCompletionRequestArgs extends FileLocationRequestArgs { + export interface BraceCompletionRequestArgs extends FileLocationRequestArgs { /** * Kind of opening brace */ openingBrace: string; } - interface JsxClosingTagRequest extends FileLocationRequest { + export interface JsxClosingTagRequest extends FileLocationRequest { readonly command: CommandTypes.JsxClosingTag; readonly arguments: JsxClosingTagRequestArgs; } - interface JsxClosingTagRequestArgs extends FileLocationRequestArgs { + export interface JsxClosingTagRequestArgs extends FileLocationRequestArgs { } - interface JsxClosingTagResponse extends Response { + export interface JsxClosingTagResponse extends Response { readonly body: TextInsertion; } - interface LinkedEditingRangeRequest extends FileLocationRequest { + export interface LinkedEditingRangeRequest extends FileLocationRequest { readonly command: CommandTypes.LinkedEditingRange; } - interface LinkedEditingRangesBody { + export interface LinkedEditingRangesBody { ranges: TextSpan[]; wordPattern?: string; } - interface LinkedEditingRangeResponse extends Response { + export interface LinkedEditingRangeResponse extends Response { readonly body: LinkedEditingRangesBody; } /** @@ -943,20 +846,20 @@ declare namespace ts { * "documentHighlights". Return response giving spans that are relevant * in the file at a given line and column. */ - interface DocumentHighlightsRequest extends FileLocationRequest { + export interface DocumentHighlightsRequest extends FileLocationRequest { command: CommandTypes.DocumentHighlights; arguments: DocumentHighlightsRequestArgs; } /** * Span augmented with extra information that denotes the kind of the highlighting to be used for span. */ - interface HighlightSpan extends TextSpanWithContext { + export interface HighlightSpan extends TextSpanWithContext { kind: HighlightSpanKind; } /** * Represents a set of highligh spans for a give name */ - interface DocumentHighlightsItem { + export interface DocumentHighlightsItem { /** * File containing highlight spans. */ @@ -969,7 +872,7 @@ declare namespace ts { /** * Response for a DocumentHighlightsRequest request. */ - interface DocumentHighlightsResponse extends Response { + export interface DocumentHighlightsResponse extends Response { body?: DocumentHighlightsItem[]; } /** @@ -977,10 +880,10 @@ declare namespace ts { * "references". Return response giving the file locations that * reference the symbol found in file at location line, col. */ - interface ReferencesRequest extends FileLocationRequest { + export interface ReferencesRequest extends FileLocationRequest { command: CommandTypes.References; } - interface ReferencesResponseItem extends FileSpanWithContext { + export interface ReferencesResponseItem extends FileSpanWithContext { /** * Text of line containing the reference. Including this * with the response avoids latency of editor loading files @@ -1004,7 +907,7 @@ declare namespace ts { /** * The body of a "references" response message. */ - interface ReferencesResponseBody { + export interface ReferencesResponseBody { /** * The file locations referencing the symbol. */ @@ -1025,13 +928,13 @@ declare namespace ts { /** * Response to "references" request. */ - interface ReferencesResponse extends Response { + export interface ReferencesResponse extends Response { body?: ReferencesResponseBody; } - interface FileReferencesRequest extends FileRequest { + export interface FileReferencesRequest extends FileRequest { command: CommandTypes.FileReferences; } - interface FileReferencesResponseBody { + export interface FileReferencesResponseBody { /** * The file locations referencing the symbol. */ @@ -1041,13 +944,13 @@ declare namespace ts { */ symbolName: string; } - interface FileReferencesResponse extends Response { + export interface FileReferencesResponse extends Response { body?: FileReferencesResponseBody; } /** * Argument for RenameRequest request. */ - interface RenameRequestArgs extends FileLocationRequestArgs { + export interface RenameRequestArgs extends FileLocationRequestArgs { /** * Should text at specified location be found/changed in comments? */ @@ -1063,65 +966,31 @@ declare namespace ts { * found in file at location line, col. Also return full display * name of the symbol so that client can print it unambiguously. */ - interface RenameRequest extends FileLocationRequest { + export interface RenameRequest extends FileLocationRequest { command: CommandTypes.Rename; arguments: RenameRequestArgs; } /** * Information about the item to be renamed. */ - type RenameInfo = RenameInfoSuccess | RenameInfoFailure; - interface RenameInfoSuccess { - /** - * True if item can be renamed. - */ - canRename: true; - /** - * File or directory to rename. - * If set, `getEditsForFileRename` should be called instead of `findRenameLocations`. - */ - fileToRename?: string; - /** - * Display name of the item to be renamed. - */ - displayName: string; - /** - * Full display name of item to be renamed. - * If item to be renamed is a file, then this is the original text of the module specifer - */ - fullDisplayName: string; - /** - * The items's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: ScriptElementKind; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** Span of text to rename. */ + export type RenameInfo = RenameInfoSuccess | RenameInfoFailure; + export type RenameInfoSuccess = ChangePropertyTypes<ts.RenameInfoSuccess, { triggerSpan: TextSpan; - } - interface RenameInfoFailure { - canRename: false; - /** - * Error message if item can not be renamed. - */ - localizedErrorMessage: string; - } + }>; /** * A group of text spans, all in 'file'. */ - interface SpanGroup { + export interface SpanGroup { /** The file to which the spans apply */ file: string; /** The text spans in this group */ locs: RenameTextSpan[]; } - interface RenameTextSpan extends TextSpanWithContext { + export interface RenameTextSpan extends TextSpanWithContext { readonly prefixText?: string; readonly suffixText?: string; } - interface RenameResponseBody { + export interface RenameResponseBody { /** * Information about the item to be renamed. */ @@ -1134,7 +1003,7 @@ declare namespace ts { /** * Rename response message. */ - interface RenameResponse extends Response { + export interface RenameResponse extends Response { body?: RenameResponseBody; } /** @@ -1146,7 +1015,7 @@ declare namespace ts { * create configured project for every config file but will maintain a link that these projects were created * as a result of opening external project so they should be removed once external project is closed. */ - interface ExternalFile { + export interface ExternalFile { /** * Name of file file */ @@ -1167,7 +1036,7 @@ declare namespace ts { /** * Represent an external project */ - interface ExternalProject { + export interface ExternalProject { /** * Project name */ @@ -1185,7 +1054,7 @@ declare namespace ts { */ typeAcquisition?: TypeAcquisition; } - interface CompileOnSaveMixin { + export interface CompileOnSaveMixin { /** * If compile on save is enabled for the project */ @@ -1195,8 +1064,8 @@ declare namespace ts { * For external projects, some of the project settings are sent together with * compiler settings. */ - type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions; - interface FileWithProjectReferenceRedirectInfo { + export type ExternalProjectCompilerOptions = CompilerOptions & CompileOnSaveMixin & WatchOptions; + export interface FileWithProjectReferenceRedirectInfo { /** * Name of file */ @@ -1209,7 +1078,7 @@ declare namespace ts { /** * Represents a set of changes that happen in project */ - interface ProjectChanges { + export interface ProjectChanges { /** * List of added files */ @@ -1231,7 +1100,7 @@ declare namespace ts { /** * Information found in a configure request. */ - interface ConfigureRequestArguments { + export interface ConfigureRequestArguments { /** * Information about the host, for example 'Emacs 24.4' or * 'Sublime Text version 3075' @@ -1252,7 +1121,7 @@ declare namespace ts { extraFileExtensions?: FileExtensionInfo[]; watchOptions?: WatchOptions; } - enum WatchFileKind { + export enum WatchFileKind { FixedPollingInterval = "FixedPollingInterval", PriorityPollingInterval = "PriorityPollingInterval", DynamicPriorityPolling = "DynamicPriorityPolling", @@ -1260,19 +1129,19 @@ declare namespace ts { UseFsEvents = "UseFsEvents", UseFsEventsOnParentDirectory = "UseFsEventsOnParentDirectory", } - enum WatchDirectoryKind { + export enum WatchDirectoryKind { UseFsEvents = "UseFsEvents", FixedPollingInterval = "FixedPollingInterval", DynamicPriorityPolling = "DynamicPriorityPolling", FixedChunkSizePolling = "FixedChunkSizePolling", } - enum PollingWatchKind { + export enum PollingWatchKind { FixedInterval = "FixedInterval", PriorityInterval = "PriorityInterval", DynamicPriority = "DynamicPriority", FixedChunkSize = "FixedChunkSize", } - interface WatchOptions { + export interface WatchOptions { watchFile?: WatchFileKind | ts.WatchFileKind; watchDirectory?: WatchDirectoryKind | ts.WatchDirectoryKind; fallbackPolling?: PollingWatchKind | ts.PollingWatchKind; @@ -1285,7 +1154,7 @@ declare namespace ts { * Configure request; value of command field is "configure". Specifies * host information, such as host type, tab size, and indent size. */ - interface ConfigureRequest extends Request { + export interface ConfigureRequest extends Request { command: CommandTypes.Configure; arguments: ConfigureRequestArguments; } @@ -1293,52 +1162,52 @@ declare namespace ts { * Response to "configure" request. This is just an acknowledgement, so * no body field is required. */ - interface ConfigureResponse extends Response { + export interface ConfigureResponse extends Response { } - interface ConfigurePluginRequestArguments { + export interface ConfigurePluginRequestArguments { pluginName: string; configuration: any; } - interface ConfigurePluginRequest extends Request { + export interface ConfigurePluginRequest extends Request { command: CommandTypes.ConfigurePlugin; arguments: ConfigurePluginRequestArguments; } - interface ConfigurePluginResponse extends Response { + export interface ConfigurePluginResponse extends Response { } - interface SelectionRangeRequest extends FileRequest { + export interface SelectionRangeRequest extends FileRequest { command: CommandTypes.SelectionRange; arguments: SelectionRangeRequestArgs; } - interface SelectionRangeRequestArgs extends FileRequestArgs { + export interface SelectionRangeRequestArgs extends FileRequestArgs { locations: Location[]; } - interface SelectionRangeResponse extends Response { + export interface SelectionRangeResponse extends Response { body?: SelectionRange[]; } - interface SelectionRange { + export interface SelectionRange { textSpan: TextSpan; parent?: SelectionRange; } - interface ToggleLineCommentRequest extends FileRequest { + export interface ToggleLineCommentRequest extends FileRequest { command: CommandTypes.ToggleLineComment; arguments: FileRangeRequestArgs; } - interface ToggleMultilineCommentRequest extends FileRequest { + export interface ToggleMultilineCommentRequest extends FileRequest { command: CommandTypes.ToggleMultilineComment; arguments: FileRangeRequestArgs; } - interface CommentSelectionRequest extends FileRequest { + export interface CommentSelectionRequest extends FileRequest { command: CommandTypes.CommentSelection; arguments: FileRangeRequestArgs; } - interface UncommentSelectionRequest extends FileRequest { + export interface UncommentSelectionRequest extends FileRequest { command: CommandTypes.UncommentSelection; arguments: FileRangeRequestArgs; } /** * Information found in an "open" request. */ - interface OpenRequestArgs extends FileRequestArgs { + export interface OpenRequestArgs extends FileRequestArgs { /** * Used when a version of the file content is known to be more up to date than the one on disk. * Then the known content will be used upon opening instead of the disk copy @@ -1355,7 +1224,7 @@ declare namespace ts { */ projectRootPath?: string; } - type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; + export type ScriptKindName = "TS" | "JS" | "TSX" | "JSX"; /** * Open request; value of command field is "open". Notify the * server that the client has file open. The server will not @@ -1364,32 +1233,32 @@ declare namespace ts { * reload messages) when the file changes. Server does not currently * send a response to an open request. */ - interface OpenRequest extends Request { + export interface OpenRequest extends Request { command: CommandTypes.Open; arguments: OpenRequestArgs; } /** * Request to open or update external project */ - interface OpenExternalProjectRequest extends Request { + export interface OpenExternalProjectRequest extends Request { command: CommandTypes.OpenExternalProject; arguments: OpenExternalProjectArgs; } /** * Arguments to OpenExternalProjectRequest request */ - type OpenExternalProjectArgs = ExternalProject; + export type OpenExternalProjectArgs = ExternalProject; /** * Request to open multiple external projects */ - interface OpenExternalProjectsRequest extends Request { + export interface OpenExternalProjectsRequest extends Request { command: CommandTypes.OpenExternalProjects; arguments: OpenExternalProjectsArgs; } /** * Arguments to OpenExternalProjectsRequest */ - interface OpenExternalProjectsArgs { + export interface OpenExternalProjectsArgs { /** * List of external projects to open or update */ @@ -1399,25 +1268,25 @@ declare namespace ts { * Response to OpenExternalProjectRequest request. This is just an acknowledgement, so * no body field is required. */ - interface OpenExternalProjectResponse extends Response { + export interface OpenExternalProjectResponse extends Response { } /** * Response to OpenExternalProjectsRequest request. This is just an acknowledgement, so * no body field is required. */ - interface OpenExternalProjectsResponse extends Response { + export interface OpenExternalProjectsResponse extends Response { } /** * Request to close external project. */ - interface CloseExternalProjectRequest extends Request { + export interface CloseExternalProjectRequest extends Request { command: CommandTypes.CloseExternalProject; arguments: CloseExternalProjectRequestArgs; } /** * Arguments to CloseExternalProjectRequest request */ - interface CloseExternalProjectRequestArgs { + export interface CloseExternalProjectRequestArgs { /** * Name of the project to close */ @@ -1427,19 +1296,19 @@ declare namespace ts { * Response to CloseExternalProjectRequest request. This is just an acknowledgement, so * no body field is required. */ - interface CloseExternalProjectResponse extends Response { + export interface CloseExternalProjectResponse extends Response { } /** * Request to synchronize list of open files with the client */ - interface UpdateOpenRequest extends Request { + export interface UpdateOpenRequest extends Request { command: CommandTypes.UpdateOpen; arguments: UpdateOpenRequestArgs; } /** * Arguments to UpdateOpenRequest */ - interface UpdateOpenRequestArgs { + export interface UpdateOpenRequestArgs { /** * List of newly open files */ @@ -1456,7 +1325,7 @@ declare namespace ts { /** * External projects have a typeAcquisition option so they need to be added separately to compiler options for inferred projects. */ - type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition; + export type InferredProjectCompilerOptions = ExternalProjectCompilerOptions & TypeAcquisition; /** * Request to set compiler options for inferred projects. * External projects are opened / closed explicitly. @@ -1466,14 +1335,14 @@ declare namespace ts { * or configured project and will contain only open file and transitive closure of referenced files if 'useOneInferredProject' is false, * or all open loose files and its transitive closure of referenced files if 'useOneInferredProject' is true. */ - interface SetCompilerOptionsForInferredProjectsRequest extends Request { + export interface SetCompilerOptionsForInferredProjectsRequest extends Request { command: CommandTypes.CompilerOptionsForInferredProjects; arguments: SetCompilerOptionsForInferredProjectsArgs; } /** * Argument for SetCompilerOptionsForInferredProjectsRequest request. */ - interface SetCompilerOptionsForInferredProjectsArgs { + export interface SetCompilerOptionsForInferredProjectsArgs { /** * Compiler options to be used with inferred projects. */ @@ -1489,13 +1358,13 @@ declare namespace ts { * Response to SetCompilerOptionsForInferredProjectsResponse request. This is just an acknowledgement, so * no body field is required. */ - interface SetCompilerOptionsForInferredProjectsResponse extends Response { + export interface SetCompilerOptionsForInferredProjectsResponse extends Response { } /** * Exit request; value of command field is "exit". Ask the server process * to exit. */ - interface ExitRequest extends Request { + export interface ExitRequest extends Request { command: CommandTypes.Exit; } /** @@ -1505,14 +1374,14 @@ declare namespace ts { * monitoring the filesystem for changes to file. Server does not * currently send a response to a close request. */ - interface CloseRequest extends FileRequest { + export interface CloseRequest extends FileRequest { command: CommandTypes.Close; } - interface WatchChangeRequest extends Request { + export interface WatchChangeRequest extends Request { command: CommandTypes.WatchChange; arguments: WatchChangeRequestArgs | readonly WatchChangeRequestArgs[]; } - interface WatchChangeRequestArgs { + export interface WatchChangeRequestArgs { id: number; created?: string[]; deleted?: string[]; @@ -1522,13 +1391,13 @@ declare namespace ts { * Request to obtain the list of files that should be regenerated if target file is recompiled. * NOTE: this us query-only operation and does not generate any output on disk. */ - interface CompileOnSaveAffectedFileListRequest extends FileRequest { + export interface CompileOnSaveAffectedFileListRequest extends FileRequest { command: CommandTypes.CompileOnSaveAffectedFileList; } /** * Contains a list of files that should be regenerated in a project */ - interface CompileOnSaveAffectedFileListSingleProject { + export interface CompileOnSaveAffectedFileListSingleProject { /** * Project name */ @@ -1545,20 +1414,20 @@ declare namespace ts { /** * Response for CompileOnSaveAffectedFileListRequest request; */ - interface CompileOnSaveAffectedFileListResponse extends Response { + export interface CompileOnSaveAffectedFileListResponse extends Response { body: CompileOnSaveAffectedFileListSingleProject[]; } /** * Request to recompile the file. All generated outputs (.js, .d.ts or .js.map files) is written on disk. */ - interface CompileOnSaveEmitFileRequest extends FileRequest { + export interface CompileOnSaveEmitFileRequest extends FileRequest { command: CommandTypes.CompileOnSaveEmitFile; arguments: CompileOnSaveEmitFileRequestArgs; } /** * Arguments for CompileOnSaveEmitFileRequest */ - interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { + export interface CompileOnSaveEmitFileRequestArgs extends FileRequestArgs { /** * if true - then file should be recompiled even if it does not have any changes. */ @@ -1567,10 +1436,10 @@ declare namespace ts { /** if true - return response as object with emitSkipped and diagnostics */ richResponse?: boolean; } - interface CompileOnSaveEmitFileResponse extends Response { + export interface CompileOnSaveEmitFileResponse extends Response { body: boolean | EmitResult; } - interface EmitResult { + export interface EmitResult { emitSkipped: boolean; diagnostics: Diagnostic[] | DiagnosticWithLinePosition[]; } @@ -1580,14 +1449,14 @@ declare namespace ts { * documentation string for the symbol found in file at location * line, col. */ - interface QuickInfoRequest extends FileLocationRequest { + export interface QuickInfoRequest extends FileLocationRequest { command: CommandTypes.Quickinfo; arguments: FileLocationRequestArgs; } /** * Body of QuickInfoResponse. */ - interface QuickInfoResponseBody { + export interface QuickInfoResponseBody { /** * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). */ @@ -1621,13 +1490,13 @@ declare namespace ts { /** * Quickinfo response message. */ - interface QuickInfoResponse extends Response { + export interface QuickInfoResponse extends Response { body?: QuickInfoResponseBody; } /** * Arguments for format messages. */ - interface FormatRequestArgs extends FileLocationRequestArgs { + export interface FormatRequestArgs extends FileLocationRequestArgs { /** * Last line of range for which to format text in file. */ @@ -1648,7 +1517,7 @@ declare namespace ts { * instructions in reverse to file will result in correctly * reformatted text. */ - interface FormatRequest extends FileLocationRequest { + export interface FormatRequest extends FileLocationRequest { command: CommandTypes.Format; arguments: FormatRequestArgs; } @@ -1659,7 +1528,7 @@ declare namespace ts { * ending one character before end with newText. For an insertion, * the text span is empty. For a deletion, newText is empty. */ - interface CodeEdit { + export interface CodeEdit { /** * First character of the text span to edit. */ @@ -1674,15 +1543,15 @@ declare namespace ts { */ newText: string; } - interface FileCodeEdits { + export interface FileCodeEdits { fileName: string; textChanges: CodeEdit[]; } - interface CodeFixResponse extends Response { + export interface CodeFixResponse extends Response { /** The code actions that are available */ body?: CodeFixAction[]; } - interface CodeAction { + export interface CodeAction { /** Description of the code action to display in the UI of the editor */ description: string; /** Text changes to apply to each file as part of the code action */ @@ -1690,11 +1559,11 @@ declare namespace ts { /** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */ commands?: {}[]; } - interface CombinedCodeActions { + export interface CombinedCodeActions { changes: readonly FileCodeEdits[]; commands?: readonly {}[]; } - interface CodeFixAction extends CodeAction { + export interface CodeFixAction extends CodeAction { /** Short name to identify the fix, for use by telemetry. */ fixName: string; /** @@ -1708,13 +1577,13 @@ declare namespace ts { /** * Format and format on key response message. */ - interface FormatResponse extends Response { + export interface FormatResponse extends Response { body?: CodeEdit[]; } /** * Arguments for format on key messages. */ - interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { + export interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { /** * Key pressed (';', '\n', or '}'). */ @@ -1729,23 +1598,14 @@ declare namespace ts { * edit instructions in reverse to file will result in correctly * reformatted text. */ - interface FormatOnKeyRequest extends FileLocationRequest { + export interface FormatOnKeyRequest extends FileLocationRequest { command: CommandTypes.Formatonkey; arguments: FormatOnKeyRequestArgs; } - type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#" | " "; - enum CompletionTriggerKind { - /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */ - Invoked = 1, - /** Completion was triggered by a trigger character. */ - TriggerCharacter = 2, - /** Completion was re-triggered as the current completion list is incomplete. */ - TriggerForIncompleteCompletions = 3, - } /** * Arguments for completions messages. */ - interface CompletionsRequestArgs extends FileLocationRequestArgs { + export interface CompletionsRequestArgs extends FileLocationRequestArgs { /** * Optional prefix to apply to possible completions. */ @@ -1771,20 +1631,20 @@ declare namespace ts { * be the empty string), return the possible completions that * begin with prefix. */ - interface CompletionsRequest extends FileLocationRequest { + export interface CompletionsRequest extends FileLocationRequest { command: CommandTypes.Completions | CommandTypes.CompletionInfo; arguments: CompletionsRequestArgs; } /** * Arguments for completion details request. */ - interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + export interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { /** * Names of one or more entries for which to obtain details. */ entryNames: (string | CompletionEntryIdentifier)[]; } - interface CompletionEntryIdentifier { + export interface CompletionEntryIdentifier { name: string; source?: string; data?: unknown; @@ -1795,252 +1655,50 @@ declare namespace ts { * col) and an array of completion entry names return more * detailed information for each completion entry. */ - interface CompletionDetailsRequest extends FileLocationRequest { + export interface CompletionDetailsRequest extends FileLocationRequest { command: CommandTypes.CompletionDetails; arguments: CompletionDetailsRequestArgs; } - /** - * Part of a symbol description. - */ - interface SymbolDisplayPart { - /** - * Text of an item describing the symbol. - */ - text: string; - /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: string; - } /** A part of a symbol description that links from a jsdoc @link tag to a declaration */ - interface JSDocLinkDisplayPart extends SymbolDisplayPart { + export interface JSDocLinkDisplayPart extends SymbolDisplayPart { /** The location of the declaration that the @link tag links to. */ target: FileSpan; } - /** - * An item found in a completion response. - */ - interface CompletionEntry { - /** - * The symbol's name. - */ - name: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: ScriptElementKind; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers?: string; - /** - * A string that is used for comparing completion items so that they can be ordered. This - * is often the same as the name but may be different in certain circumstances. - */ - sortText: string; - /** - * Text to insert instead of `name`. - * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`, - * coupled with `replacementSpan` to replace a dotted access with a bracket access. - */ - insertText?: string; - /** - * A string that should be used when filtering a set of - * completion items. - */ - filterText?: string; - /** - * `insertText` should be interpreted as a snippet if true. - */ - isSnippet?: true; - /** - * An optional span that indicates the text to be replaced by this completion item. - * If present, this span should be used instead of the default one. - * It will be set if the required span differs from the one generated by the default replacement behavior. - */ - replacementSpan?: TextSpan; - /** - * Indicates whether commiting this completion entry will require additional code actions to be - * made to avoid errors. The CompletionEntryDetails will have these actions. - */ - hasAction?: true; - /** - * Identifier (not necessarily human-readable) identifying where this completion came from. - */ - source?: string; - /** - * Human-readable description of the `source`. - */ - sourceDisplay?: SymbolDisplayPart[]; - /** - * Additional details for the label. - */ - labelDetails?: CompletionEntryLabelDetails; - /** - * If true, this completion should be highlighted as recommended. There will only be one of these. - * This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class. - * Then either that enum/class or a namespace containing it will be the recommended symbol. - */ - isRecommended?: true; - /** - * If true, this completion was generated from traversing the name table of an unchecked JS file, - * and therefore may not be accurate. - */ - isFromUncheckedFile?: true; - /** - * If true, this completion was for an auto-import of a module not yet in the program, but listed - * in the project package.json. Used for telemetry reporting. - */ - isPackageJsonImport?: true; - /** - * If true, this completion was an auto-import-style completion of an import statement (i.e., the - * module specifier was inserted along with the imported identifier). Used for telemetry reporting. - */ - isImportStatementCompletion?: true; - /** - * A property to be sent back to TS Server in the CompletionDetailsRequest, along with `name`, - * that allows TS Server to look up the symbol represented by the completion item, disambiguating - * items with the same name. - */ - data?: unknown; - } - interface CompletionEntryLabelDetails { - /** - * An optional string which is rendered less prominently directly after - * {@link CompletionEntry.name name}, without any spacing. Should be - * used for function signatures or type annotations. - */ - detail?: string; - /** - * An optional string which is rendered less prominently after - * {@link CompletionEntryLabelDetails.detail}. Should be used for fully qualified - * names or file path. - */ - description?: string; - } + export type CompletionEntry = ChangePropertyTypes<Omit<ts.CompletionEntry, "symbol">, { + replacementSpan: TextSpan; + data: unknown; + }>; /** * Additional completion entry details, available on demand */ - interface CompletionEntryDetails { - /** - * The symbol's name. - */ - name: string; - /** - * The symbol's kind (such as 'className' or 'parameterName'). - */ - kind: ScriptElementKind; - /** - * Optional modifiers for the kind (such as 'public'). - */ - kindModifiers: string; - /** - * Display parts of the symbol (similar to quick info). - */ - displayParts: SymbolDisplayPart[]; - /** - * Documentation strings for the symbol. - */ - documentation?: SymbolDisplayPart[]; - /** - * JSDoc tags for the symbol. - */ - tags?: JSDocTagInfo[]; - /** - * The associated code actions for this entry - */ - codeActions?: CodeAction[]; - /** - * @deprecated Use `sourceDisplay` instead. - */ - source?: SymbolDisplayPart[]; - /** - * Human-readable description of the `source` from the CompletionEntry. - */ - sourceDisplay?: SymbolDisplayPart[]; - } + export type CompletionEntryDetails = ChangePropertyTypes<ts.CompletionEntryDetails, { + tags: JSDocTagInfo[]; + codeActions: CodeAction[]; + }>; /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */ - interface CompletionsResponse extends Response { + export interface CompletionsResponse extends Response { body?: CompletionEntry[]; } - interface CompletionInfoResponse extends Response { + export interface CompletionInfoResponse extends Response { body?: CompletionInfo; } - interface CompletionInfo { - readonly flags?: number; - readonly isGlobalCompletion: boolean; - readonly isMemberCompletion: boolean; - readonly isNewIdentifierLocation: boolean; - /** - * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use - * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span - * must be used to commit that completion entry. - */ - readonly optionalReplacementSpan?: TextSpan; - readonly isIncomplete?: boolean; - readonly entries: readonly CompletionEntry[]; - } - interface CompletionDetailsResponse extends Response { + export type CompletionInfo = ChangePropertyTypes<ts.CompletionInfo, { + entries: readonly CompletionEntry[]; + optionalReplacementSpan: TextSpan; + }>; + export interface CompletionDetailsResponse extends Response { body?: CompletionEntryDetails[]; } /** - * Signature help information for a single parameter - */ - interface SignatureHelpParameter { - /** - * The parameter's name - */ - name: string; - /** - * Documentation of the parameter. - */ - documentation: SymbolDisplayPart[]; - /** - * Display parts of the parameter. - */ - displayParts: SymbolDisplayPart[]; - /** - * Whether the parameter is optional or not. - */ - isOptional: boolean; - } - /** * Represents a single signature to show in signature help. */ - interface SignatureHelpItem { - /** - * Whether the signature accepts a variable number of arguments. - */ - isVariadic: boolean; - /** - * The prefix display parts. - */ - prefixDisplayParts: SymbolDisplayPart[]; - /** - * The suffix display parts. - */ - suffixDisplayParts: SymbolDisplayPart[]; - /** - * The separator display parts. - */ - separatorDisplayParts: SymbolDisplayPart[]; - /** - * The signature helps items for the parameters. - */ - parameters: SignatureHelpParameter[]; - /** - * The signature's documentation - */ - documentation: SymbolDisplayPart[]; - /** - * The signature's JSDoc tags - */ + export type SignatureHelpItem = ChangePropertyTypes<ts.SignatureHelpItem, { tags: JSDocTagInfo[]; - } + }>; /** * Signature help items found in the response of a signature help request. */ - interface SignatureHelpItems { + export interface SignatureHelpItems { /** * The signature help items. */ @@ -2062,68 +1720,32 @@ declare namespace ts { */ argumentCount: number; } - type SignatureHelpTriggerCharacter = "," | "(" | "<"; - type SignatureHelpRetriggerCharacter = SignatureHelpTriggerCharacter | ")"; /** * Arguments of a signature help request. */ - interface SignatureHelpRequestArgs extends FileLocationRequestArgs { + export interface SignatureHelpRequestArgs extends FileLocationRequestArgs { /** * Reason why signature help was invoked. * See each individual possible */ triggerReason?: SignatureHelpTriggerReason; } - type SignatureHelpTriggerReason = SignatureHelpInvokedReason | SignatureHelpCharacterTypedReason | SignatureHelpRetriggeredReason; - /** - * Signals that the user manually requested signature help. - * The language service will unconditionally attempt to provide a result. - */ - interface SignatureHelpInvokedReason { - kind: "invoked"; - triggerCharacter?: undefined; - } - /** - * Signals that the signature help request came from a user typing a character. - * Depending on the character and the syntactic context, the request may or may not be served a result. - */ - interface SignatureHelpCharacterTypedReason { - kind: "characterTyped"; - /** - * Character that was responsible for triggering signature help. - */ - triggerCharacter: SignatureHelpTriggerCharacter; - } - /** - * Signals that this signature help request came from typing a character or moving the cursor. - * This should only occur if a signature help session was already active and the editor needs to see if it should adjust. - * The language service will unconditionally attempt to provide a result. - * `triggerCharacter` can be `undefined` for a retrigger caused by a cursor move. - */ - interface SignatureHelpRetriggeredReason { - kind: "retrigger"; - /** - * Character that was responsible for triggering signature help. - */ - triggerCharacter?: SignatureHelpRetriggerCharacter; - } /** * Signature help request; value of command field is "signatureHelp". * Given a file location (file, line, col), return the signature * help. */ - interface SignatureHelpRequest extends FileLocationRequest { + export interface SignatureHelpRequest extends FileLocationRequest { command: CommandTypes.SignatureHelp; arguments: SignatureHelpRequestArgs; } /** * Response object for a SignatureHelpRequest. */ - interface SignatureHelpResponse extends Response { + export interface SignatureHelpResponse extends Response { body?: SignatureHelpItems; } - type InlayHintKind = "Type" | "Parameter" | "Enum"; - interface InlayHintsRequestArgs extends FileRequestArgs { + export interface InlayHintsRequestArgs extends FileRequestArgs { /** * Start position of the span. */ @@ -2133,68 +1755,90 @@ declare namespace ts { */ length: number; } - interface InlayHintsRequest extends Request { + export interface InlayHintsRequest extends Request { command: CommandTypes.ProvideInlayHints; arguments: InlayHintsRequestArgs; } - interface InlayHintItem { - /** This property will be the empty string when displayParts is set. */ - text: string; + export type InlayHintItem = ChangePropertyTypes<ts.InlayHint, { position: Location; - kind: InlayHintKind; - whitespaceBefore?: boolean; - whitespaceAfter?: boolean; - displayParts?: InlayHintItemDisplayPart[]; - } - interface InlayHintItemDisplayPart { + displayParts: InlayHintItemDisplayPart[]; + }>; + export interface InlayHintItemDisplayPart { text: string; span?: FileSpan; } - interface InlayHintsResponse extends Response { + export interface InlayHintsResponse extends Response { body?: InlayHintItem[]; } + export interface MapCodeRequestArgs extends FileRequestArgs { + /** + * The files and changes to try and apply/map. + */ + mapping: MapCodeRequestDocumentMapping; + } + export interface MapCodeRequestDocumentMapping { + /** + * The specific code to map/insert/replace in the file. + */ + contents: string[]; + /** + * Areas of "focus" to inform the code mapper with. For example, cursor + * location, current selection, viewport, etc. Nested arrays denote + * priority: toplevel arrays are more important than inner arrays, and + * inner array priorities are based on items within that array. Items + * earlier in the arrays have higher priority. + */ + focusLocations?: TextSpan[][]; + } + export interface MapCodeRequest extends FileRequest { + command: CommandTypes.MapCode; + arguments: MapCodeRequestArgs; + } + export interface MapCodeResponse extends Response { + body: readonly FileCodeEdits[]; + } /** * Synchronous request for semantic diagnostics of one file. */ - interface SemanticDiagnosticsSyncRequest extends FileRequest { + export interface SemanticDiagnosticsSyncRequest extends FileRequest { command: CommandTypes.SemanticDiagnosticsSync; arguments: SemanticDiagnosticsSyncRequestArgs; } - interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { + export interface SemanticDiagnosticsSyncRequestArgs extends FileRequestArgs { includeLinePosition?: boolean; } /** * Response object for synchronous sematic diagnostics request. */ - interface SemanticDiagnosticsSyncResponse extends Response { + export interface SemanticDiagnosticsSyncResponse extends Response { body?: Diagnostic[] | DiagnosticWithLinePosition[]; } - interface SuggestionDiagnosticsSyncRequest extends FileRequest { + export interface SuggestionDiagnosticsSyncRequest extends FileRequest { command: CommandTypes.SuggestionDiagnosticsSync; arguments: SuggestionDiagnosticsSyncRequestArgs; } - type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs; - type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse; + export type SuggestionDiagnosticsSyncRequestArgs = SemanticDiagnosticsSyncRequestArgs; + export type SuggestionDiagnosticsSyncResponse = SemanticDiagnosticsSyncResponse; /** * Synchronous request for syntactic diagnostics of one file. */ - interface SyntacticDiagnosticsSyncRequest extends FileRequest { + export interface SyntacticDiagnosticsSyncRequest extends FileRequest { command: CommandTypes.SyntacticDiagnosticsSync; arguments: SyntacticDiagnosticsSyncRequestArgs; } - interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { + export interface SyntacticDiagnosticsSyncRequestArgs extends FileRequestArgs { includeLinePosition?: boolean; } /** * Response object for synchronous syntactic diagnostics request. */ - interface SyntacticDiagnosticsSyncResponse extends Response { + export interface SyntacticDiagnosticsSyncResponse extends Response { body?: Diagnostic[] | DiagnosticWithLinePosition[]; } /** * Arguments for GeterrForProject request. */ - interface GeterrForProjectRequestArgs { + export interface GeterrForProjectRequestArgs { /** * the file requesting project error list */ @@ -2210,14 +1854,14 @@ declare namespace ts { * "geterrForProject". It works similarly with 'Geterr', only * it request for every file in this project. */ - interface GeterrForProjectRequest extends Request { + export interface GeterrForProjectRequest extends Request { command: CommandTypes.GeterrForProject; arguments: GeterrForProjectRequestArgs; } /** * Arguments for geterr messages. */ - interface GeterrRequestArgs { + export interface GeterrRequestArgs { /** * List of file names for which to compute compiler errors. * The files will be checked in list order. @@ -2239,25 +1883,25 @@ declare namespace ts { * practice for an editor is to send a file list containing each * file that is currently visible, in most-recently-used order. */ - interface GeterrRequest extends Request { + export interface GeterrRequest extends Request { command: CommandTypes.Geterr; arguments: GeterrRequestArgs; } - type RequestCompletedEventName = "requestCompleted"; + export type RequestCompletedEventName = "requestCompleted"; /** * Event that is sent when server have finished processing request with specified id. */ - interface RequestCompletedEvent extends Event { + export interface RequestCompletedEvent extends Event { event: RequestCompletedEventName; body: RequestCompletedEventBody; } - interface RequestCompletedEventBody { + export interface RequestCompletedEventBody { request_seq: number; } /** * Item of diagnostic information found in a DiagnosticEvent message. */ - interface Diagnostic { + export interface Diagnostic { /** * Starting file location at which text applies. */ @@ -2289,7 +1933,7 @@ declare namespace ts { */ source?: string; } - interface DiagnosticWithFileName extends Diagnostic { + export interface DiagnosticWithFileName extends Diagnostic { /** * Name of the file the diagnostic is in */ @@ -2298,7 +1942,7 @@ declare namespace ts { /** * Represents additional spans returned with a diagnostic which are relevant to it */ - interface DiagnosticRelatedInformation { + export interface DiagnosticRelatedInformation { /** * The category of the related information message, e.g. "error", "warning", or "suggestion". */ @@ -2316,7 +1960,7 @@ declare namespace ts { */ span?: FileSpan; } - interface DiagnosticEventBody { + export interface DiagnosticEventBody { /** * The file for which diagnostic information is reported. */ @@ -2326,16 +1970,16 @@ declare namespace ts { */ diagnostics: Diagnostic[]; } - type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag"; + export type DiagnosticEventKind = "semanticDiag" | "syntaxDiag" | "suggestionDiag"; /** * Event message for DiagnosticEventKind event types. * These events provide syntactic and semantic errors for a file. */ - interface DiagnosticEvent extends Event { + export interface DiagnosticEvent extends Event { body?: DiagnosticEventBody; event: DiagnosticEventKind; } - interface ConfigFileDiagnosticEventBody { + export interface ConfigFileDiagnosticEventBody { /** * The file which trigged the searching and error-checking of the config file */ @@ -2353,16 +1997,16 @@ declare namespace ts { * Event message for "configFileDiag" event type. * This event provides errors for a found config file. */ - interface ConfigFileDiagnosticEvent extends Event { + export interface ConfigFileDiagnosticEvent extends Event { body?: ConfigFileDiagnosticEventBody; event: "configFileDiag"; } - type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; - interface ProjectLanguageServiceStateEvent extends Event { + export type ProjectLanguageServiceStateEventName = "projectLanguageServiceState"; + export interface ProjectLanguageServiceStateEvent extends Event { event: ProjectLanguageServiceStateEventName; body?: ProjectLanguageServiceStateEventBody; } - interface ProjectLanguageServiceStateEventBody { + export interface ProjectLanguageServiceStateEventBody { /** * Project name that has changes in the state of language service. * For configured projects this will be the config file path. @@ -2376,52 +2020,52 @@ declare namespace ts { */ languageServiceEnabled: boolean; } - type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground"; - interface ProjectsUpdatedInBackgroundEvent extends Event { + export type ProjectsUpdatedInBackgroundEventName = "projectsUpdatedInBackground"; + export interface ProjectsUpdatedInBackgroundEvent extends Event { event: ProjectsUpdatedInBackgroundEventName; body: ProjectsUpdatedInBackgroundEventBody; } - interface ProjectsUpdatedInBackgroundEventBody { + export interface ProjectsUpdatedInBackgroundEventBody { /** * Current set of open files */ openFiles: string[]; } - type ProjectLoadingStartEventName = "projectLoadingStart"; - interface ProjectLoadingStartEvent extends Event { + export type ProjectLoadingStartEventName = "projectLoadingStart"; + export interface ProjectLoadingStartEvent extends Event { event: ProjectLoadingStartEventName; body: ProjectLoadingStartEventBody; } - interface ProjectLoadingStartEventBody { + export interface ProjectLoadingStartEventBody { /** name of the project */ projectName: string; /** reason for loading */ reason: string; } - type ProjectLoadingFinishEventName = "projectLoadingFinish"; - interface ProjectLoadingFinishEvent extends Event { + export type ProjectLoadingFinishEventName = "projectLoadingFinish"; + export interface ProjectLoadingFinishEvent extends Event { event: ProjectLoadingFinishEventName; body: ProjectLoadingFinishEventBody; } - interface ProjectLoadingFinishEventBody { + export interface ProjectLoadingFinishEventBody { /** name of the project */ projectName: string; } - type SurveyReadyEventName = "surveyReady"; - interface SurveyReadyEvent extends Event { + export type SurveyReadyEventName = "surveyReady"; + export interface SurveyReadyEvent extends Event { event: SurveyReadyEventName; body: SurveyReadyEventBody; } - interface SurveyReadyEventBody { + export interface SurveyReadyEventBody { /** Name of the survey. This is an internal machine- and programmer-friendly name */ surveyId: string; } - type LargeFileReferencedEventName = "largeFileReferenced"; - interface LargeFileReferencedEvent extends Event { + export type LargeFileReferencedEventName = "largeFileReferenced"; + export interface LargeFileReferencedEvent extends Event { event: LargeFileReferencedEventName; body: LargeFileReferencedEventBody; } - interface LargeFileReferencedEventBody { + export interface LargeFileReferencedEventBody { /** * name of the large file being loaded */ @@ -2435,38 +2079,38 @@ declare namespace ts { */ maxFileSize: number; } - type CreateFileWatcherEventName = "createFileWatcher"; - interface CreateFileWatcherEvent extends Event { + export type CreateFileWatcherEventName = "createFileWatcher"; + export interface CreateFileWatcherEvent extends Event { readonly event: CreateFileWatcherEventName; readonly body: CreateFileWatcherEventBody; } - interface CreateFileWatcherEventBody { + export interface CreateFileWatcherEventBody { readonly id: number; readonly path: string; } - type CreateDirectoryWatcherEventName = "createDirectoryWatcher"; - interface CreateDirectoryWatcherEvent extends Event { + export type CreateDirectoryWatcherEventName = "createDirectoryWatcher"; + export interface CreateDirectoryWatcherEvent extends Event { readonly event: CreateDirectoryWatcherEventName; readonly body: CreateDirectoryWatcherEventBody; } - interface CreateDirectoryWatcherEventBody { + export interface CreateDirectoryWatcherEventBody { readonly id: number; readonly path: string; readonly recursive: boolean; readonly ignoreUpdate?: boolean; } - type CloseFileWatcherEventName = "closeFileWatcher"; - interface CloseFileWatcherEvent extends Event { + export type CloseFileWatcherEventName = "closeFileWatcher"; + export interface CloseFileWatcherEvent extends Event { readonly event: CloseFileWatcherEventName; readonly body: CloseFileWatcherEventBody; } - interface CloseFileWatcherEventBody { + export interface CloseFileWatcherEventBody { readonly id: number; } /** * Arguments for reload request. */ - interface ReloadRequestArgs extends FileRequestArgs { + export interface ReloadRequestArgs extends FileRequestArgs { /** * Name of temporary file from which to reload file * contents. May be same as file. @@ -2479,7 +2123,7 @@ declare namespace ts { * from temporary file with name given by the 'tmpfile' argument. * The two names can be identical. */ - interface ReloadRequest extends FileRequest { + export interface ReloadRequest extends FileRequest { command: CommandTypes.Reload; arguments: ReloadRequestArgs; } @@ -2487,12 +2131,12 @@ declare namespace ts { * Response to "reload" request. This is just an acknowledgement, so * no body field is required. */ - interface ReloadResponse extends Response { + export interface ReloadResponse extends Response { } /** * Arguments for saveto request. */ - interface SavetoRequestArgs extends FileRequestArgs { + export interface SavetoRequestArgs extends FileRequestArgs { /** * Name of temporary file into which to save server's view of * file contents. @@ -2506,14 +2150,14 @@ declare namespace ts { * 'file'. The server does not currently send a response to a * "saveto" request. */ - interface SavetoRequest extends FileRequest { + export interface SavetoRequest extends FileRequest { command: CommandTypes.Saveto; arguments: SavetoRequestArgs; } /** * Arguments for navto request message. */ - interface NavtoRequestArgs { + export interface NavtoRequestArgs { /** * Search term to navigate to from current location; term can * be '.*' or an identifier prefix. @@ -2540,14 +2184,14 @@ declare namespace ts { * match the search term given in argument 'searchTerm'. The * context for the search is given by the named file. */ - interface NavtoRequest extends Request { + export interface NavtoRequest extends Request { command: CommandTypes.Navto; arguments: NavtoRequestArgs; } /** * An item found in a navto response. */ - interface NavtoItem extends FileSpan { + export interface NavtoItem extends FileSpan { /** * The symbol's name. */ @@ -2582,13 +2226,13 @@ declare namespace ts { * Navto response message. Body is an array of navto items. Each * item gives a symbol that matched the search term. */ - interface NavtoResponse extends Response { + export interface NavtoResponse extends Response { body?: NavtoItem[]; } /** * Arguments for change request message. */ - interface ChangeRequestArgs extends FormatRequestArgs { + export interface ChangeRequestArgs extends FormatRequestArgs { /** * Optional string to insert at location (file, line, offset). */ @@ -2599,14 +2243,14 @@ declare namespace ts { * Update the server's view of the file named by argument 'file'. * Server does not currently send a response to a change request. */ - interface ChangeRequest extends FileLocationRequest { + export interface ChangeRequest extends FileLocationRequest { command: CommandTypes.Change; arguments: ChangeRequestArgs; } /** * Response to "brace" request. */ - interface BraceResponse extends Response { + export interface BraceResponse extends Response { body?: TextSpan[]; } /** @@ -2614,7 +2258,7 @@ declare namespace ts { * Return response giving the file locations of matching braces * found in file at location line, offset. */ - interface BraceRequest extends FileLocationRequest { + export interface BraceRequest extends FileLocationRequest { command: CommandTypes.Brace; } /** @@ -2622,17 +2266,17 @@ declare namespace ts { * Return response giving the list of navigation bar entries * extracted from the requested file. */ - interface NavBarRequest extends FileRequest { + export interface NavBarRequest extends FileRequest { command: CommandTypes.NavBar; } /** * NavTree request; value of command field is "navtree". * Return response giving the navigation tree of the requested file. */ - interface NavTreeRequest extends FileRequest { + export interface NavTreeRequest extends FileRequest { command: CommandTypes.NavTree; } - interface NavigationBarItem { + export interface NavigationBarItem { /** * The item's display text. */ @@ -2659,7 +2303,7 @@ declare namespace ts { indent: number; } /** protocol.NavigationTree is identical to ts.NavigationTree, except using protocol.TextSpan instead of ts.TextSpan */ - interface NavigationTree { + export interface NavigationTree { text: string; kind: ScriptElementKind; kindModifiers: string; @@ -2667,29 +2311,29 @@ declare namespace ts { nameSpan: TextSpan | undefined; childItems?: NavigationTree[]; } - type TelemetryEventName = "telemetry"; - interface TelemetryEvent extends Event { + export type TelemetryEventName = "telemetry"; + export interface TelemetryEvent extends Event { event: TelemetryEventName; body: TelemetryEventBody; } - interface TelemetryEventBody { + export interface TelemetryEventBody { telemetryEventName: string; payload: any; } - type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed"; - interface TypesInstallerInitializationFailedEvent extends Event { + export type TypesInstallerInitializationFailedEventName = "typesInstallerInitializationFailed"; + export interface TypesInstallerInitializationFailedEvent extends Event { event: TypesInstallerInitializationFailedEventName; body: TypesInstallerInitializationFailedEventBody; } - interface TypesInstallerInitializationFailedEventBody { + export interface TypesInstallerInitializationFailedEventBody { message: string; } - type TypingsInstalledTelemetryEventName = "typingsInstalled"; - interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { + export type TypingsInstalledTelemetryEventName = "typingsInstalled"; + export interface TypingsInstalledTelemetryEventBody extends TelemetryEventBody { telemetryEventName: TypingsInstalledTelemetryEventName; payload: TypingsInstalledTelemetryEventPayload; } - interface TypingsInstalledTelemetryEventPayload { + export interface TypingsInstalledTelemetryEventPayload { /** * Comma separated list of installed typing packages */ @@ -2703,17 +2347,17 @@ declare namespace ts { */ typingsInstallerVersion: string; } - type BeginInstallTypesEventName = "beginInstallTypes"; - type EndInstallTypesEventName = "endInstallTypes"; - interface BeginInstallTypesEvent extends Event { + export type BeginInstallTypesEventName = "beginInstallTypes"; + export type EndInstallTypesEventName = "endInstallTypes"; + export interface BeginInstallTypesEvent extends Event { event: BeginInstallTypesEventName; body: BeginInstallTypesEventBody; } - interface EndInstallTypesEvent extends Event { + export interface EndInstallTypesEvent extends Event { event: EndInstallTypesEventName; body: EndInstallTypesEventBody; } - interface InstallTypesEventBody { + export interface InstallTypesEventBody { /** * correlation id to match begin and end events */ @@ -2723,378 +2367,123 @@ declare namespace ts { */ packages: readonly string[]; } - interface BeginInstallTypesEventBody extends InstallTypesEventBody { + export interface BeginInstallTypesEventBody extends InstallTypesEventBody { } - interface EndInstallTypesEventBody extends InstallTypesEventBody { + export interface EndInstallTypesEventBody extends InstallTypesEventBody { /** * true if installation succeeded, otherwise false */ success: boolean; } - interface NavBarResponse extends Response { + export interface NavBarResponse extends Response { body?: NavigationBarItem[]; } - interface NavTreeResponse extends Response { + export interface NavTreeResponse extends Response { body?: NavigationTree; } - interface CallHierarchyItem { - name: string; - kind: ScriptElementKind; - kindModifiers?: string; - file: string; + export type CallHierarchyItem = ChangePropertyTypes<ts.CallHierarchyItem, { span: TextSpan; selectionSpan: TextSpan; - containerName?: string; - } - interface CallHierarchyIncomingCall { + }>; + export interface CallHierarchyIncomingCall { from: CallHierarchyItem; fromSpans: TextSpan[]; } - interface CallHierarchyOutgoingCall { + export interface CallHierarchyOutgoingCall { to: CallHierarchyItem; fromSpans: TextSpan[]; } - interface PrepareCallHierarchyRequest extends FileLocationRequest { + export interface PrepareCallHierarchyRequest extends FileLocationRequest { command: CommandTypes.PrepareCallHierarchy; } - interface PrepareCallHierarchyResponse extends Response { + export interface PrepareCallHierarchyResponse extends Response { readonly body: CallHierarchyItem | CallHierarchyItem[]; } - interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest { + export interface ProvideCallHierarchyIncomingCallsRequest extends FileLocationRequest { command: CommandTypes.ProvideCallHierarchyIncomingCalls; } - interface ProvideCallHierarchyIncomingCallsResponse extends Response { + export interface ProvideCallHierarchyIncomingCallsResponse extends Response { readonly body: CallHierarchyIncomingCall[]; } - interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest { + export interface ProvideCallHierarchyOutgoingCallsRequest extends FileLocationRequest { command: CommandTypes.ProvideCallHierarchyOutgoingCalls; } - interface ProvideCallHierarchyOutgoingCallsResponse extends Response { + export interface ProvideCallHierarchyOutgoingCallsResponse extends Response { readonly body: CallHierarchyOutgoingCall[]; } - enum IndentStyle { + export enum IndentStyle { None = "None", Block = "Block", Smart = "Smart", } - enum SemicolonPreference { - Ignore = "ignore", - Insert = "insert", - Remove = "remove", - } - interface EditorSettings { - baseIndentSize?: number; - indentSize?: number; - tabSize?: number; - newLineCharacter?: string; - convertTabsToSpaces?: boolean; - indentStyle?: IndentStyle | ts.IndentStyle; - trimTrailingWhitespace?: boolean; - } - interface FormatCodeSettings extends EditorSettings { - insertSpaceAfterCommaDelimiter?: boolean; - insertSpaceAfterSemicolonInForStatements?: boolean; - insertSpaceBeforeAndAfterBinaryOperators?: boolean; - insertSpaceAfterConstructor?: boolean; - insertSpaceAfterKeywordsInControlFlowStatements?: boolean; - insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean; - insertSpaceAfterOpeningAndBeforeClosingEmptyBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; - insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean; - insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean; - insertSpaceAfterTypeAssertion?: boolean; - insertSpaceBeforeFunctionParenthesis?: boolean; - placeOpenBraceOnNewLineForFunctions?: boolean; - placeOpenBraceOnNewLineForControlBlocks?: boolean; - insertSpaceBeforeTypeAnnotation?: boolean; - semicolons?: SemicolonPreference; - indentSwitchCase?: boolean; - } - interface UserPreferences { - readonly disableSuggestions?: boolean; - readonly quotePreference?: "auto" | "double" | "single"; - /** - * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. - * This affects lone identifier completions but not completions on the right hand side of `obj.`. - */ - readonly includeCompletionsForModuleExports?: boolean; - /** - * Enables auto-import-style completions on partially-typed import statements. E.g., allows - * `import write|` to be completed to `import { writeFile } from "fs"`. - */ - readonly includeCompletionsForImportStatements?: boolean; - /** - * Allows completions to be formatted with snippet text, indicated by `CompletionItem["isSnippet"]`. - */ - readonly includeCompletionsWithSnippetText?: boolean; - /** - * If enabled, the completion list will include completions with invalid identifier names. - * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. - */ - readonly includeCompletionsWithInsertText?: boolean; - /** - * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled, - * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined - * values, with insertion text to replace preceding `.` tokens with `?.`. - */ - readonly includeAutomaticOptionalChainCompletions?: boolean; - /** - * If enabled, completions for class members (e.g. methods and properties) will include - * a whole declaration for the member. - * E.g., `class A { f| }` could be completed to `class A { foo(): number {} }`, instead of - * `class A { foo }`. - */ - readonly includeCompletionsWithClassMemberSnippets?: boolean; - /** - * If enabled, object literal methods will have a method declaration completion entry in addition - * to the regular completion entry containing just the method name. - * E.g., `const objectLiteral: T = { f| }` could be completed to `const objectLiteral: T = { foo(): void {} }`, - * in addition to `const objectLiteral: T = { foo }`. - */ - readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean; - /** - * Indicates whether {@link CompletionEntry.labelDetails completion entry label details} are supported. - * If not, contents of `labelDetails` may be included in the {@link CompletionEntry.name} property. - */ - readonly useLabelDetailsInCompletionEntries?: boolean; - readonly allowIncompleteCompletions?: boolean; - readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative"; - /** Determines whether we import `foo/index.ts` as "foo", "foo/index", or "foo/index.js" */ - readonly importModuleSpecifierEnding?: "auto" | "minimal" | "index" | "js"; - readonly allowTextChangesInNewFiles?: boolean; - readonly lazyConfiguredProjectsFromExternalProject?: boolean; - readonly providePrefixAndSuffixTextForRename?: boolean; - readonly provideRefactorNotApplicableReason?: boolean; - readonly allowRenameOfImportPath?: boolean; - readonly includePackageJsonAutoImports?: "auto" | "on" | "off"; - readonly jsxAttributeCompletionStyle?: "auto" | "braces" | "none"; - readonly displayPartsForJSDoc?: boolean; - readonly generateReturnInDocTemplate?: boolean; - readonly includeInlayParameterNameHints?: "none" | "literals" | "all"; - readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; - readonly includeInlayFunctionParameterTypeHints?: boolean; - readonly includeInlayVariableTypeHints?: boolean; - readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; - readonly includeInlayPropertyDeclarationTypeHints?: boolean; - readonly includeInlayFunctionLikeReturnTypeHints?: boolean; - readonly includeInlayEnumMemberValueHints?: boolean; - readonly interactiveInlayHints?: boolean; - readonly autoImportFileExcludePatterns?: string[]; - /** - * Indicates whether imports should be organized in a case-insensitive manner. - */ - readonly organizeImportsIgnoreCase?: "auto" | boolean; - /** - * Indicates whether imports should be organized via an "ordinal" (binary) comparison using the numeric value - * of their code points, or via "unicode" collation (via the - * [Unicode Collation Algorithm](https://unicode.org/reports/tr10/#Scope)) using rules associated with the locale - * specified in {@link organizeImportsCollationLocale}. - * - * Default: `"ordinal"`. - */ - readonly organizeImportsCollation?: "ordinal" | "unicode"; - /** - * Indicates the locale to use for "unicode" collation. If not specified, the locale `"en"` is used as an invariant - * for the sake of consistent sorting. Use `"auto"` to use the detected UI locale. - * - * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. - * - * Default: `"en"` - */ - readonly organizeImportsCollationLocale?: string; - /** - * Indicates whether numeric collation should be used for digit sequences in strings. When `true`, will collate - * strings such that `a1z < a2z < a100z`. When `false`, will collate strings such that `a1z < a100z < a2z`. - * - * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. - * - * Default: `false` - */ - readonly organizeImportsNumericCollation?: boolean; - /** - * Indicates whether accents and other diacritic marks are considered unequal for the purpose of collation. When - * `true`, characters with accents and other diacritics will be collated in the order defined by the locale specified - * in {@link organizeImportsCollationLocale}. - * - * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. - * - * Default: `true` - */ - readonly organizeImportsAccentCollation?: boolean; - /** - * Indicates whether upper case or lower case should sort first. When `false`, the default order for the locale - * specified in {@link organizeImportsCollationLocale} is used. - * - * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. This preference is also - * ignored if we are using case-insensitive sorting, which occurs when {@link organizeImportsIgnoreCase} is `true`, - * or if {@link organizeImportsIgnoreCase} is `"auto"` and the auto-detected case sensitivity is determined to be - * case-insensitive. - * - * Default: `false` - */ - readonly organizeImportsCaseFirst?: "upper" | "lower" | false; - /** - * Indicates where named type-only imports should sort. "inline" sorts named imports without regard to if the import is - * type-only. - * - * Default: `last` - */ - readonly organizeImportsTypeOrder?: "last" | "first" | "inline"; - /** - * Indicates whether {@link ReferencesResponseItem.lineText} is supported. - */ - readonly disableLineTextInReferences?: boolean; - /** - * Indicates whether to exclude standard library and node_modules file symbols from navTo results. - */ - readonly excludeLibrarySymbolsInNavTo?: boolean; - } - interface CompilerOptions { - allowJs?: boolean; - allowSyntheticDefaultImports?: boolean; - allowUnreachableCode?: boolean; - allowUnusedLabels?: boolean; - alwaysStrict?: boolean; - baseUrl?: string; - charset?: string; - checkJs?: boolean; - declaration?: boolean; - declarationDir?: string; - disableSizeLimit?: boolean; - downlevelIteration?: boolean; - emitBOM?: boolean; - emitDecoratorMetadata?: boolean; - experimentalDecorators?: boolean; - forceConsistentCasingInFileNames?: boolean; - importHelpers?: boolean; - inlineSourceMap?: boolean; - inlineSources?: boolean; - isolatedModules?: boolean; - jsx?: JsxEmit | ts.JsxEmit; - lib?: string[]; - locale?: string; - mapRoot?: string; - maxNodeModuleJsDepth?: number; - module?: ModuleKind | ts.ModuleKind; - moduleResolution?: ModuleResolutionKind | ts.ModuleResolutionKind; - newLine?: NewLineKind | ts.NewLineKind; - noEmit?: boolean; - noEmitHelpers?: boolean; - noEmitOnError?: boolean; - noErrorTruncation?: boolean; - noFallthroughCasesInSwitch?: boolean; - noImplicitAny?: boolean; - noImplicitReturns?: boolean; - noImplicitThis?: boolean; - noUnusedLocals?: boolean; - noUnusedParameters?: boolean; - noImplicitUseStrict?: boolean; - noLib?: boolean; - noResolve?: boolean; - out?: string; - outDir?: string; - outFile?: string; - paths?: MapLike<string[]>; - plugins?: PluginImport[]; - preserveConstEnums?: boolean; - preserveSymlinks?: boolean; - project?: string; - reactNamespace?: string; - removeComments?: boolean; - references?: ProjectReference[]; - rootDir?: string; - rootDirs?: string[]; - skipLibCheck?: boolean; - skipDefaultLibCheck?: boolean; - sourceMap?: boolean; - sourceRoot?: string; - strict?: boolean; - strictNullChecks?: boolean; - suppressExcessPropertyErrors?: boolean; - suppressImplicitAnyIndexErrors?: boolean; - useDefineForClassFields?: boolean; - target?: ScriptTarget | ts.ScriptTarget; - traceResolution?: boolean; - resolveJsonModule?: boolean; - types?: string[]; - /** Paths used to used to compute primary types search locations */ - typeRoots?: string[]; - [option: string]: CompilerOptionsValue | undefined; - } - enum JsxEmit { - None = "None", - Preserve = "Preserve", - ReactNative = "ReactNative", - React = "React", - } - enum ModuleKind { - None = "None", - CommonJS = "CommonJS", - AMD = "AMD", - UMD = "UMD", - System = "System", - ES6 = "ES6", - ES2015 = "ES2015", - ESNext = "ESNext", - Node16 = "Node16", - NodeNext = "NodeNext", - Preserve = "Preserve", - } - enum ModuleResolutionKind { - Classic = "Classic", + export type EditorSettings = ChangePropertyTypes<ts.EditorSettings, { + indentStyle: IndentStyle | ts.IndentStyle; + }>; + export type FormatCodeSettings = ChangePropertyTypes<ts.FormatCodeSettings, { + indentStyle: IndentStyle | ts.IndentStyle; + }>; + export type CompilerOptions = ChangePropertyTypes<ChangeStringIndexSignature<ts.CompilerOptions, CompilerOptionsValue>, { + jsx: JsxEmit | ts.JsxEmit; + module: ModuleKind | ts.ModuleKind; + moduleResolution: ModuleResolutionKind | ts.ModuleResolutionKind; + newLine: NewLineKind | ts.NewLineKind; + target: ScriptTarget | ts.ScriptTarget; + }>; + export enum JsxEmit { + None = "none", + Preserve = "preserve", + ReactNative = "react-native", + React = "react", + ReactJSX = "react-jsx", + ReactJSXDev = "react-jsxdev", + } + export enum ModuleKind { + None = "none", + CommonJS = "commonjs", + AMD = "amd", + UMD = "umd", + System = "system", + ES6 = "es6", + ES2015 = "es2015", + ES2020 = "es2020", + ES2022 = "es2022", + ESNext = "esnext", + Node16 = "node16", + NodeNext = "nodenext", + Preserve = "preserve", + } + export enum ModuleResolutionKind { + Classic = "classic", + /** @deprecated Renamed to `Node10` */ + Node = "node", /** @deprecated Renamed to `Node10` */ - Node = "Node", - Node10 = "Node10", - Node16 = "Node16", - NodeNext = "NodeNext", - Bundler = "Bundler", + NodeJs = "node", + Node10 = "node10", + Node16 = "node16", + NodeNext = "nodenext", + Bundler = "bundler", } - enum NewLineKind { + export enum NewLineKind { Crlf = "Crlf", Lf = "Lf", } - enum ScriptTarget { - ES3 = "ES3", - ES5 = "ES5", - ES6 = "ES6", - ES2015 = "ES2015", - ES2016 = "ES2016", - ES2017 = "ES2017", - ES2018 = "ES2018", - ES2019 = "ES2019", - ES2020 = "ES2020", - ES2021 = "ES2021", - ES2022 = "ES2022", - ESNext = "ESNext", - } - enum ClassificationType { - comment = 1, - identifier = 2, - keyword = 3, - numericLiteral = 4, - operator = 5, - stringLiteral = 6, - regularExpressionLiteral = 7, - whiteSpace = 8, - text = 9, - punctuation = 10, - className = 11, - enumName = 12, - interfaceName = 13, - moduleName = 14, - typeParameterName = 15, - typeAliasName = 16, - parameterName = 17, - docCommentTagName = 18, - jsxOpenTagName = 19, - jsxCloseTagName = 20, - jsxSelfClosingTagName = 21, - jsxAttribute = 22, - jsxText = 23, - jsxAttributeStringLiteralValue = 24, - bigintLiteral = 25, + export enum ScriptTarget { + /** @deprecated */ + ES3 = "es3", + ES5 = "es5", + ES6 = "es6", + ES2015 = "es2015", + ES2016 = "es2016", + ES2017 = "es2017", + ES2018 = "es2018", + ES2019 = "es2019", + ES2020 = "es2020", + ES2021 = "es2021", + ES2022 = "es2022", + ES2023 = "es2023", + ESNext = "esnext", + JSON = "json", + Latest = "esnext", } } namespace typingsInstaller { @@ -3143,6 +2532,90 @@ declare namespace ts { protected readonly latestDistTag = "latest"; } } + type ActionSet = "action::set"; + type ActionInvalidate = "action::invalidate"; + type ActionPackageInstalled = "action::packageInstalled"; + type EventTypesRegistry = "event::typesRegistry"; + type EventBeginInstallTypes = "event::beginInstallTypes"; + type EventEndInstallTypes = "event::endInstallTypes"; + type EventInitializationFailed = "event::initializationFailed"; + type ActionWatchTypingLocations = "action::watchTypingLocations"; + interface TypingInstallerResponse { + readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed | ActionWatchTypingLocations; + } + interface TypingInstallerRequestWithProjectName { + readonly projectName: string; + } + interface DiscoverTypings extends TypingInstallerRequestWithProjectName { + readonly fileNames: string[]; + readonly projectRootPath: Path; + readonly compilerOptions: CompilerOptions; + readonly typeAcquisition: TypeAcquisition; + readonly unresolvedImports: SortedReadonlyArray<string>; + readonly cachePath?: string; + readonly kind: "discover"; + } + interface CloseProject extends TypingInstallerRequestWithProjectName { + readonly kind: "closeProject"; + } + interface TypesRegistryRequest { + readonly kind: "typesRegistry"; + } + interface InstallPackageRequest extends TypingInstallerRequestWithProjectName { + readonly kind: "installPackage"; + readonly fileName: Path; + readonly packageName: string; + readonly projectRootPath: Path; + readonly id: number; + } + interface PackageInstalledResponse extends ProjectResponse { + readonly kind: ActionPackageInstalled; + readonly id: number; + readonly success: boolean; + readonly message: string; + } + interface InitializationFailedResponse extends TypingInstallerResponse { + readonly kind: EventInitializationFailed; + readonly message: string; + readonly stack?: string; + } + interface ProjectResponse extends TypingInstallerResponse { + readonly projectName: string; + } + interface InvalidateCachedTypings extends ProjectResponse { + readonly kind: ActionInvalidate; + } + interface InstallTypes extends ProjectResponse { + readonly kind: EventBeginInstallTypes | EventEndInstallTypes; + readonly eventId: number; + readonly typingsInstallerVersion: string; + readonly packagesToInstall: readonly string[]; + } + interface BeginInstallTypes extends InstallTypes { + readonly kind: EventBeginInstallTypes; + } + interface EndInstallTypes extends InstallTypes { + readonly kind: EventEndInstallTypes; + readonly installSuccess: boolean; + } + interface InstallTypingHost extends JsTyping.TypingResolutionHost { + useCaseSensitiveFileNames: boolean; + writeFile(path: string, content: string): void; + createDirectory(path: string): void; + getCurrentDirectory?(): string; + } + interface SetTypings extends ProjectResponse { + readonly typeAcquisition: TypeAcquisition; + readonly compilerOptions: CompilerOptions; + readonly typings: string[]; + readonly unresolvedImports: SortedReadonlyArray<string>; + readonly kind: ActionSet; + } + interface WatchTypingLocations extends ProjectResponse { + /** if files is undefined, retain same set of watchers */ + readonly files: readonly string[] | undefined; + readonly kind: ActionWatchTypingLocations; + } interface CompressedData { length: number; compressionKind: string; @@ -3311,7 +2784,6 @@ declare namespace ts { private compilerOptions; compileOnSaveEnabled: boolean; protected watchOptions: WatchOptions | undefined; - private rootFiles; private rootFilesMap; private program; private externalFiles; @@ -3392,7 +2864,7 @@ declare namespace ts { private detachScriptInfoIfNotRoot; isClosed(): boolean; hasRoots(): boolean; - getRootFiles(): ts.server.NormalizedPath[]; + getRootFiles(): NormalizedPath[]; getRootScriptInfos(): ts.server.ScriptInfo[]; getScriptInfos(): ScriptInfo[]; getExcludedFiles(): readonly NormalizedPath[]; @@ -3405,7 +2877,6 @@ declare namespace ts { addMissingFileRoot(fileName: NormalizedPath): void; removeFile(info: ScriptInfo, fileExists: boolean, detachFromProject: boolean): void; registerFileUpdate(fileName: string): void; - markAsDirty(): void; /** * Updates set of files that contribute to this project * @returns: true if set of files in the project stays the same and false - otherwise. @@ -3450,10 +2921,8 @@ declare namespace ts { class AutoImportProviderProject extends Project { private hostProject; private rootFileNames; - isOrphan(): boolean; updateGraph(): boolean; hasRoots(): boolean; - markAsDirty(): void; getScriptFileNames(): string[]; getLanguageService(): never; getHostForAutoImportProvider(): never; @@ -3466,8 +2935,6 @@ declare namespace ts { */ class ConfiguredProject extends Project { readonly canonicalConfigFilePath: NormalizedPath; - /** Ref count to the project when opened from external project */ - private externalProjectRefCount; private projectReferences; /** * If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph @@ -3710,7 +3177,11 @@ declare namespace ts { /** * Open files: with value being project root path, and key being Path of the file that is open */ - readonly openFiles: Map<string, NormalizedPath | undefined>; + readonly openFiles: Map<Path, NormalizedPath | undefined>; + /** Config files looked up and cached config files for open script info */ + private readonly configFileForOpenFiles; + /** Set of open script infos that are root of inferred project */ + private rootOfInferredProjects; /** * Map of open files that are opened without complete path but have projectRoot as current directory */ @@ -3729,6 +3200,11 @@ declare namespace ts { private safelist; private readonly legacySafelist; private pendingProjectUpdates; + /** + * All the open script info that needs recalculation of the default project, + * this also caches config file info before config file change was detected to use it in case projects are not updated yet + */ + private pendingOpenFileProjectUpdates?; readonly currentDirectory: NormalizedPath; readonly toCanonicalFileName: (f: string) => string; readonly host: ServerHost; @@ -3760,6 +3236,11 @@ declare namespace ts { setCompilerOptionsForInferredProjects(projectCompilerOptions: protocol.InferredProjectCompilerOptions, projectRootPath?: string): void; findProject(projectName: string): Project | undefined; getDefaultProjectForFile(fileName: NormalizedPath, ensureProject: boolean): Project | undefined; + /** + * If there is default project calculation pending for this file, + * then it completes that calculation so that correct default project is used for the project + */ + private tryGetDefaultProjectForEnsuringConfiguredProjectForFile; private doEnsureDefaultProjectForFile; getScriptInfoEnsuringProjectsUptoDate(uncheckedFileName: string): ScriptInfo | undefined; /** @@ -3789,14 +3270,6 @@ declare namespace ts { private deleteScriptInfo; private configFileExists; /** - * Returns true if the configFileExistenceInfo is needed/impacted by open files that are root of inferred project - */ - private configFileExistenceImpactsRootOfInferredProject; - /** - * This is called on file close, so that we stop watching the config file for this script info - */ - private stopWatchingConfigFilesForClosedScriptInfo; - /** * This function tries to search for a tsconfig.json for the given file. * This is different from the method the compiler uses because * the compiler can assume it will always start searching in the @@ -3805,17 +3278,10 @@ declare namespace ts { * the newly opened file. */ private forEachConfigFileLocation; - /** - * This function tries to search for a tsconfig.json for the given file. - * This is different from the method the compiler uses because - * the compiler can assume it will always start searching in the - * current directory (the directory in which tsc was invoked). - * The server must start searching from the directory containing - * the newly opened file. - * If script info is passed in, it is asserted to be open script info - * otherwise just file name - */ - private getConfigFileNameForFile; + /** Get cached configFileName for scriptInfo or ancestor of open script info */ + private getConfigFileNameForFileFromCache; + /** Caches the configFilename for script info or ancestor of open script info */ + private setConfigFileNameForFileInCache; private printProjects; private getConfiguredProjectByCanonicalConfigFilePath; private findExternalProjectByProjectName; @@ -3825,7 +3291,6 @@ declare namespace ts { private addFilesToNonInferredProject; private updateNonInferredProjectFiles; private updateRootAndOptionsOfNonInferredProject; - private sendConfigFileDiagEvent; private getOrCreateInferredProjectForProjectRootPathIfEnabled; private getOrCreateSingleInferredProjectIfEnabled; private getOrCreateSingleInferredWithoutProjectRoot; @@ -3839,7 +3304,6 @@ declare namespace ts { private refreshScriptInfosInDirectory; private stopWatchingScriptInfo; private getOrCreateScriptInfoNotOpenedByClientForNormalizedPath; - private getOrCreateScriptInfoOpenedByClientForNormalizedPath; getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: { fileExists(path: string): boolean; }): ScriptInfo | undefined; @@ -3859,14 +3323,6 @@ declare namespace ts { */ reloadProjects(): void; /** - * This function goes through all the openFiles and tries to file the config file for them. - * If the config file is found and it refers to existing project, it reloads it either immediately - * or schedules it for reload depending on delayReload option - * If there is no existing project it just opens the configured project for the config file - * reloadForInfo provides a way to filter out files to reload configured project for - */ - private reloadConfiguredProjectForFiles; - /** * Remove the root of inferred project if script info is part of another project */ private removeRootOfInferredProjectIfNowPartOfOtherProject; @@ -3887,11 +3343,21 @@ declare namespace ts { private findExternalProjectContainingOpenScriptInfo; private getOrCreateOpenScriptInfo; private assignProjectToOpenedScriptInfo; - private createAncestorProjects; + /** + * Finds the default configured project for given info + * For any tsconfig found, it looks into that project, if not then all its references, + * The search happens for all tsconfigs till projectRootPath + */ + private tryFindDefaultConfiguredProjectForOpenScriptInfo; + /** + * Finds the default configured project, if found, it creates the solution projects (does not load them right away) + * with Find: finds the projects even if the project is deferredClosed + */ + private tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo; private ensureProjectChildren; - private cleanupAfterOpeningFile; + private cleanupConfiguredProjects; + private cleanupProjectsAndScriptInfos; openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult; - private removeOrphanConfiguredProjects; private removeOrphanScriptInfos; private telemetryOnOpenFile; /** @@ -3900,7 +3366,6 @@ declare namespace ts { */ closeClientFile(uncheckedFileName: string): void; private collectChanges; - private closeConfiguredProjectReferencedFromExternalProject; closeExternalProject(uncheckedFileName: string): void; openExternalProjects(projects: protocol.ExternalProject[]): void; /** Makes a filename safe to insert in a RegExp */ @@ -3913,7 +3378,6 @@ declare namespace ts { hasDeferredExtension(): boolean; private enableRequestedPluginsAsync; private enableRequestedPluginsWorker; - private enableRequestedPluginsForProjectAsync; configurePlugin(args: protocol.ConfigurePluginRequestArguments): void; } function formatMessage<T extends protocol.Message>(msg: T, logger: Logger, byteLength: (s: string, encoding: BufferEncoding) => number, newLine: string): string; @@ -4032,6 +3496,7 @@ declare namespace ts { private getLinkedEditingRange; private getDocumentHighlights; private provideInlayHints; + private mapCode; private setCompilerOptionsForInferredProjects; private getProjectInfo; private getProjectInfoWorker; @@ -4091,6 +3556,7 @@ declare namespace ts { private getApplicableRefactors; private getEditsForRefactor; private getMoveToRefactoringFileSuggestions; + private getPasteEdits; private organizeImports; private getEditsForFileRename; private getCodeFixes; @@ -4099,6 +3565,7 @@ declare namespace ts { private getStartAndEndPosition; private mapCodeAction; private mapCodeFixAction; + private mapPasteEditsAction; private mapTextChangesToCodeEdits; private mapTextChangeToCodeEdit; private convertTextChangeToCodeEdit; @@ -4173,7 +3640,15 @@ declare namespace ts { subPath: string | undefined; } } - const versionMajorMinor = "5.4"; + namespace JsTyping { + interface TypingResolutionHost { + directoryExists(path: string): boolean; + fileExists(fileName: string): boolean; + readFile(path: string, encoding?: string): string | undefined; + readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[]; + } + } + const versionMajorMinor = "5.5"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -4512,65 +3987,59 @@ declare namespace ts { ShorthandPropertyAssignment = 304, SpreadAssignment = 305, EnumMember = 306, - /** @deprecated */ UnparsedPrologue = 307, - /** @deprecated */ UnparsedPrepend = 308, - /** @deprecated */ UnparsedText = 309, - /** @deprecated */ UnparsedInternalText = 310, - /** @deprecated */ UnparsedSyntheticReference = 311, - SourceFile = 312, - Bundle = 313, - /** @deprecated */ UnparsedSource = 314, - /** @deprecated */ InputFiles = 315, - JSDocTypeExpression = 316, - JSDocNameReference = 317, - JSDocMemberName = 318, - JSDocAllType = 319, - JSDocUnknownType = 320, - JSDocNullableType = 321, - JSDocNonNullableType = 322, - JSDocOptionalType = 323, - JSDocFunctionType = 324, - JSDocVariadicType = 325, - JSDocNamepathType = 326, - JSDoc = 327, + SourceFile = 307, + Bundle = 308, + JSDocTypeExpression = 309, + JSDocNameReference = 310, + JSDocMemberName = 311, + JSDocAllType = 312, + JSDocUnknownType = 313, + JSDocNullableType = 314, + JSDocNonNullableType = 315, + JSDocOptionalType = 316, + JSDocFunctionType = 317, + JSDocVariadicType = 318, + JSDocNamepathType = 319, + JSDoc = 320, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 327, - JSDocText = 328, - JSDocTypeLiteral = 329, - JSDocSignature = 330, - JSDocLink = 331, - JSDocLinkCode = 332, - JSDocLinkPlain = 333, - JSDocTag = 334, - JSDocAugmentsTag = 335, - JSDocImplementsTag = 336, - JSDocAuthorTag = 337, - JSDocDeprecatedTag = 338, - JSDocClassTag = 339, - JSDocPublicTag = 340, - JSDocPrivateTag = 341, - JSDocProtectedTag = 342, - JSDocReadonlyTag = 343, - JSDocOverrideTag = 344, - JSDocCallbackTag = 345, - JSDocOverloadTag = 346, - JSDocEnumTag = 347, - JSDocParameterTag = 348, - JSDocReturnTag = 349, - JSDocThisTag = 350, - JSDocTypeTag = 351, - JSDocTemplateTag = 352, - JSDocTypedefTag = 353, - JSDocSeeTag = 354, - JSDocPropertyTag = 355, - JSDocThrowsTag = 356, - JSDocSatisfiesTag = 357, - SyntaxList = 358, - NotEmittedStatement = 359, - PartiallyEmittedExpression = 360, - CommaListExpression = 361, - SyntheticReferenceExpression = 362, - Count = 363, + JSDocComment = 320, + JSDocText = 321, + JSDocTypeLiteral = 322, + JSDocSignature = 323, + JSDocLink = 324, + JSDocLinkCode = 325, + JSDocLinkPlain = 326, + JSDocTag = 327, + JSDocAugmentsTag = 328, + JSDocImplementsTag = 329, + JSDocAuthorTag = 330, + JSDocDeprecatedTag = 331, + JSDocClassTag = 332, + JSDocPublicTag = 333, + JSDocPrivateTag = 334, + JSDocProtectedTag = 335, + JSDocReadonlyTag = 336, + JSDocOverrideTag = 337, + JSDocCallbackTag = 338, + JSDocOverloadTag = 339, + JSDocEnumTag = 340, + JSDocParameterTag = 341, + JSDocReturnTag = 342, + JSDocThisTag = 343, + JSDocTypeTag = 344, + JSDocTemplateTag = 345, + JSDocTypedefTag = 346, + JSDocSeeTag = 347, + JSDocPropertyTag = 348, + JSDocThrowsTag = 349, + JSDocSatisfiesTag = 350, + JSDocImportTag = 351, + SyntaxList = 352, + NotEmittedStatement = 353, + PartiallyEmittedExpression = 354, + CommaListExpression = 355, + SyntheticReferenceExpression = 356, + Count = 357, FirstAssignment = 64, LastAssignment = 79, FirstCompoundAssignment = 65, @@ -4598,10 +4067,10 @@ declare namespace ts { FirstStatement = 243, LastStatement = 259, FirstNode = 166, - FirstJSDocNode = 316, - LastJSDocNode = 357, - FirstJSDocTagNode = 334, - LastJSDocTagNode = 357, + FirstJSDocNode = 309, + LastJSDocNode = 351, + FirstJSDocTagNode = 327, + LastJSDocTagNode = 351, } type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -4756,7 +4225,7 @@ declare namespace ts { type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; - type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.Unknown | KeywordSyntaxKind; + type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.GreaterThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.Unknown | KeywordSyntaxKind; enum NodeFlags { None = 0, Let = 1, @@ -4837,7 +4306,7 @@ declare namespace ts { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): Node[]; + getChildren(sourceFile?: SourceFile): readonly Node[]; getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; getFullStart(): number; getEnd(): number; @@ -5000,12 +4469,6 @@ declare namespace ts { interface Identifier { readonly text: string; } - interface Identifier { - /** @deprecated Use `idKeyword(identifier)` instead. */ - readonly originalKeywordKind?: SyntaxKind; - /** @deprecated Use `.parent` or the surrounding context to determine this instead. */ - readonly isInJSDocNamespace?: boolean; - } interface TransientIdentifier extends Identifier { resolvedSymbol: Symbol; } @@ -6051,7 +5514,7 @@ declare namespace ts { type NamedExportBindings = NamespaceExport | NamedExports; interface ImportClause extends NamedDeclaration { readonly kind: SyntaxKind.ImportClause; - readonly parent: ImportDeclaration; + readonly parent: ImportDeclaration | JSDocImportTag; readonly isTypeOnly: boolean; readonly name?: Identifier; readonly namedBindings?: NamedImportBindings; @@ -6190,6 +5653,7 @@ declare namespace ts { interface FileReference extends TextRange { fileName: string; resolutionMode?: ResolutionMode; + preserve?: boolean; } interface CheckJsDirective extends TextRange { enabled: boolean; @@ -6407,60 +5871,12 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocSatisfiesTag; readonly typeExpression: JSDocTypeExpression; } - enum FlowFlags { - Unreachable = 1, - Start = 2, - BranchLabel = 4, - LoopLabel = 8, - Assignment = 16, - TrueCondition = 32, - FalseCondition = 64, - SwitchClause = 128, - ArrayMutation = 256, - Call = 512, - ReduceLabel = 1024, - Referenced = 2048, - Shared = 4096, - Label = 12, - Condition = 96, - } - type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; - interface FlowNodeBase { - flags: FlowFlags; - id?: number; - } - interface FlowStart extends FlowNodeBase { - node?: FunctionExpression | ArrowFunction | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration; - } - interface FlowLabel extends FlowNodeBase { - antecedents: FlowNode[] | undefined; - } - interface FlowAssignment extends FlowNodeBase { - node: Expression | VariableDeclaration | BindingElement; - antecedent: FlowNode; - } - interface FlowCall extends FlowNodeBase { - node: CallExpression; - antecedent: FlowNode; - } - interface FlowCondition extends FlowNodeBase { - node: Expression; - antecedent: FlowNode; - } - interface FlowSwitchClause extends FlowNodeBase { - switchStatement: SwitchStatement; - clauseStart: number; - clauseEnd: number; - antecedent: FlowNode; - } - interface FlowArrayMutation extends FlowNodeBase { - node: CallExpression | BinaryExpression; - antecedent: FlowNode; - } - interface FlowReduceLabel extends FlowNodeBase { - target: FlowLabel; - antecedents: FlowNode[]; - antecedent: FlowNode; + interface JSDocImportTag extends JSDocTag { + readonly kind: SyntaxKind.JSDocImportTag; + readonly parent: JSDoc; + readonly importClause?: ImportClause; + readonly moduleSpecifier: Expression; + readonly attributes?: ImportAttributes; } type FlowType = Type | IncompleteType; interface IncompleteType { @@ -6532,70 +5948,8 @@ declare namespace ts { } interface Bundle extends Node { readonly kind: SyntaxKind.Bundle; - /** @deprecated */ readonly prepends: readonly (InputFiles | UnparsedSource)[]; readonly sourceFiles: readonly SourceFile[]; } - /** @deprecated */ - interface InputFiles extends Node { - readonly kind: SyntaxKind.InputFiles; - javascriptPath?: string; - javascriptText: string; - javascriptMapPath?: string; - javascriptMapText?: string; - declarationPath?: string; - declarationText: string; - declarationMapPath?: string; - declarationMapText?: string; - } - /** @deprecated */ - interface UnparsedSource extends Node { - readonly kind: SyntaxKind.UnparsedSource; - fileName: string; - text: string; - readonly prologues: readonly UnparsedPrologue[]; - helpers: readonly UnscopedEmitHelper[] | undefined; - referencedFiles: readonly FileReference[]; - typeReferenceDirectives: readonly FileReference[] | undefined; - libReferenceDirectives: readonly FileReference[]; - hasNoDefaultLib?: boolean; - sourceMapPath?: string; - sourceMapText?: string; - readonly syntheticReferences?: readonly UnparsedSyntheticReference[]; - readonly texts: readonly UnparsedSourceText[]; - } - /** @deprecated */ - type UnparsedSourceText = UnparsedPrepend | UnparsedTextLike; - /** @deprecated */ - type UnparsedNode = UnparsedPrologue | UnparsedSourceText | UnparsedSyntheticReference; - /** @deprecated */ - interface UnparsedSection extends Node { - readonly kind: SyntaxKind; - readonly parent: UnparsedSource; - readonly data?: string; - } - /** @deprecated */ - interface UnparsedPrologue extends UnparsedSection { - readonly kind: SyntaxKind.UnparsedPrologue; - readonly parent: UnparsedSource; - readonly data: string; - } - /** @deprecated */ - interface UnparsedPrepend extends UnparsedSection { - readonly kind: SyntaxKind.UnparsedPrepend; - readonly parent: UnparsedSource; - readonly data: string; - readonly texts: readonly UnparsedTextLike[]; - } - /** @deprecated */ - interface UnparsedTextLike extends UnparsedSection { - readonly kind: SyntaxKind.UnparsedText | SyntaxKind.UnparsedInternalText; - readonly parent: UnparsedSource; - } - /** @deprecated */ - interface UnparsedSyntheticReference extends UnparsedSection { - readonly kind: SyntaxKind.UnparsedSyntheticReference; - readonly parent: UnparsedSource; - } interface JsonSourceFile extends SourceFile { readonly statements: NodeArray<JsonObjectExpressionStatement>; } @@ -7276,6 +6630,7 @@ declare namespace ts { ContainsSpread = 2097152, ObjectRestType = 4194304, InstantiationExpressionType = 8388608, + SingleSignatureType = 134217728, } interface ObjectType extends Type { objectFlags: ObjectFlags; @@ -7530,7 +6885,7 @@ declare namespace ts { path: string; /** The path as the user originally wrote it */ originalPath?: string; - /** True if the output of this reference should be prepended to the output of this project. Only valid for --outFile compilations */ + /** @deprecated */ prepend?: boolean; /** True if it is intended that this reference form a circularity */ circular?: boolean; @@ -7566,6 +6921,7 @@ declare namespace ts { allowUnusedLabels?: boolean; alwaysStrict?: boolean; baseUrl?: string; + /** @deprecated */ charset?: string; checkJs?: boolean; customConditions?: string[]; @@ -7585,11 +6941,14 @@ declare namespace ts { forceConsistentCasingInFileNames?: boolean; ignoreDeprecations?: string; importHelpers?: boolean; + /** @deprecated */ importsNotUsedAsValues?: ImportsNotUsedAsValues; inlineSourceMap?: boolean; inlineSources?: boolean; isolatedModules?: boolean; + isolatedDeclarations?: boolean; jsx?: JsxEmit; + /** @deprecated */ keyofStringsOnly?: boolean; lib?: string[]; locale?: string; @@ -7608,15 +6967,18 @@ declare namespace ts { noImplicitAny?: boolean; noImplicitReturns?: boolean; noImplicitThis?: boolean; + /** @deprecated */ noStrictGenericChecks?: boolean; noUnusedLocals?: boolean; noUnusedParameters?: boolean; + /** @deprecated */ noImplicitUseStrict?: boolean; noPropertyAccessFromIndexSignature?: boolean; assumeChangesOnlyAffectDirectDependencies?: boolean; noLib?: boolean; noResolve?: boolean; noUncheckedIndexedAccess?: boolean; + /** @deprecated */ out?: string; outDir?: string; outFile?: string; @@ -7624,6 +6986,7 @@ declare namespace ts { preserveConstEnums?: boolean; noImplicitOverride?: boolean; preserveSymlinks?: boolean; + /** @deprecated */ preserveValueImports?: boolean; project?: string; reactNamespace?: string; @@ -7648,7 +7011,9 @@ declare namespace ts { strictNullChecks?: boolean; strictPropertyInitialization?: boolean; stripInternal?: boolean; + /** @deprecated */ suppressExcessPropertyErrors?: boolean; + /** @deprecated */ suppressImplicitAnyIndexErrors?: boolean; target?: ScriptTarget; traceResolution?: boolean; @@ -7700,6 +7065,7 @@ declare namespace ts { ReactJSX = 4, ReactJSXDev = 5, } + /** @deprecated */ enum ImportsNotUsedAsValues { Remove = 0, Preserve = 1, @@ -7729,6 +7095,7 @@ declare namespace ts { Deferred = 7, } enum ScriptTarget { + /** @deprecated */ ES3 = 0, ES5 = 1, ES2015 = 2, @@ -7739,6 +7106,7 @@ declare namespace ts { ES2020 = 7, ES2021 = 8, ES2022 = 9, + ES2023 = 10, ESNext = 99, JSON = 100, Latest = 99, @@ -8371,6 +7739,8 @@ declare namespace ts { updateJSDocThrowsTag(node: JSDocThrowsTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment?: string | NodeArray<JSDocComment> | undefined): JSDocThrowsTag; createJSDocSatisfiesTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray<JSDocComment>): JSDocSatisfiesTag; updateJSDocSatisfiesTag(node: JSDocSatisfiesTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray<JSDocComment> | undefined): JSDocSatisfiesTag; + createJSDocImportTag(tagName: Identifier | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, attributes?: ImportAttributes, comment?: string | NodeArray<JSDocComment>): JSDocImportTag; + updateJSDocImportTag(node: JSDocImportTag, tagName: Identifier | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, attributes: ImportAttributes | undefined, comment: string | NodeArray<JSDocComment> | undefined): JSDocImportTag; createJSDocText(text: string): JSDocText; updateJSDocText(node: JSDocText, text: string): JSDocText; createJSDocComment(comment?: string | NodeArray<JSDocComment> | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; @@ -8423,9 +7793,7 @@ declare namespace ts { createCommaListExpression(elements: readonly Expression[]): CommaListExpression; updateCommaListExpression(node: CommaListExpression, elements: readonly Expression[]): CommaListExpression; createBundle(sourceFiles: readonly SourceFile[]): Bundle; - /** @deprecated*/ createBundle(sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[]): Bundle; updateBundle(node: Bundle, sourceFiles: readonly SourceFile[]): Bundle; - /** @deprecated*/ updateBundle(node: Bundle, sourceFiles: readonly SourceFile[], prepends?: readonly (UnparsedSource | InputFiles)[]): Bundle; createComma(left: Expression, right: Expression): BinaryExpression; createAssignment(left: ObjectLiteralExpression | ArrayLiteralExpression, right: Expression): DestructuringAssignment; createAssignment(left: Expression, right: Expression): AssignmentExpression<EqualsToken>; @@ -8704,7 +8072,6 @@ declare namespace ts { } interface SyntaxList extends Node { kind: SyntaxKind.SyntaxList; - _children: Node[]; } enum ListFormat { None = 0, @@ -8807,13 +8174,49 @@ declare namespace ts { interface UserPreferences { readonly disableSuggestions?: boolean; readonly quotePreference?: "auto" | "double" | "single"; + /** + * If enabled, TypeScript will search through all external modules' exports and add them to the completions list. + * This affects lone identifier completions but not completions on the right hand side of `obj.`. + */ readonly includeCompletionsForModuleExports?: boolean; + /** + * Enables auto-import-style completions on partially-typed import statements. E.g., allows + * `import write|` to be completed to `import { writeFile } from "fs"`. + */ readonly includeCompletionsForImportStatements?: boolean; + /** + * Allows completions to be formatted with snippet text, indicated by `CompletionItem["isSnippet"]`. + */ readonly includeCompletionsWithSnippetText?: boolean; + /** + * Unless this option is `false`, or `includeCompletionsWithInsertText` is not enabled, + * member completion lists triggered with `.` will include entries on potentially-null and potentially-undefined + * values, with insertion text to replace preceding `.` tokens with `?.`. + */ readonly includeAutomaticOptionalChainCompletions?: boolean; + /** + * If enabled, the completion list will include completions with invalid identifier names. + * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. + */ readonly includeCompletionsWithInsertText?: boolean; + /** + * If enabled, completions for class members (e.g. methods and properties) will include + * a whole declaration for the member. + * E.g., `class A { f| }` could be completed to `class A { foo(): number {} }`, instead of + * `class A { foo }`. + */ readonly includeCompletionsWithClassMemberSnippets?: boolean; + /** + * If enabled, object literal methods will have a method declaration completion entry in addition + * to the regular completion entry containing just the method name. + * E.g., `const objectLiteral: T = { f| }` could be completed to `const objectLiteral: T = { foo(): void {} }`, + * in addition to `const objectLiteral: T = { foo }`. + */ readonly includeCompletionsWithObjectLiteralMethodSnippets?: boolean; + /** + * Indicates whether {@link CompletionEntry.labelDetails completion entry label details} are supported. + * If not, contents of `labelDetails` may be included in the {@link CompletionEntry.name} property. + */ readonly useLabelDetailsInCompletionEntries?: boolean; readonly allowIncompleteCompletions?: boolean; readonly importModuleSpecifierPreference?: "shortest" | "project-relative" | "relative" | "non-relative"; @@ -8836,15 +8239,76 @@ declare namespace ts { readonly allowRenameOfImportPath?: boolean; readonly autoImportFileExcludePatterns?: string[]; readonly preferTypeOnlyAutoImports?: boolean; + /** + * Indicates whether imports should be organized in a case-insensitive manner. + */ readonly organizeImportsIgnoreCase?: "auto" | boolean; + /** + * Indicates whether imports should be organized via an "ordinal" (binary) comparison using the numeric value + * of their code points, or via "unicode" collation (via the + * [Unicode Collation Algorithm](https://unicode.org/reports/tr10/#Scope)) using rules associated with the locale + * specified in {@link organizeImportsCollationLocale}. + * + * Default: `"ordinal"`. + */ readonly organizeImportsCollation?: "ordinal" | "unicode"; + /** + * Indicates the locale to use for "unicode" collation. If not specified, the locale `"en"` is used as an invariant + * for the sake of consistent sorting. Use `"auto"` to use the detected UI locale. + * + * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. + * + * Default: `"en"` + */ readonly organizeImportsLocale?: string; + /** + * Indicates whether numeric collation should be used for digit sequences in strings. When `true`, will collate + * strings such that `a1z < a2z < a100z`. When `false`, will collate strings such that `a1z < a100z < a2z`. + * + * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. + * + * Default: `false` + */ readonly organizeImportsNumericCollation?: boolean; + /** + * Indicates whether accents and other diacritic marks are considered unequal for the purpose of collation. When + * `true`, characters with accents and other diacritics will be collated in the order defined by the locale specified + * in {@link organizeImportsCollationLocale}. + * + * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. + * + * Default: `true` + */ readonly organizeImportsAccentCollation?: boolean; + /** + * Indicates whether upper case or lower case should sort first. When `false`, the default order for the locale + * specified in {@link organizeImportsCollationLocale} is used. + * + * This preference is ignored if {@link organizeImportsCollation} is not `"unicode"`. This preference is also + * ignored if we are using case-insensitive sorting, which occurs when {@link organizeImportsIgnoreCase} is `true`, + * or if {@link organizeImportsIgnoreCase} is `"auto"` and the auto-detected case sensitivity is determined to be + * case-insensitive. + * + * Default: `false` + */ readonly organizeImportsCaseFirst?: "upper" | "lower" | false; - readonly organizeImportsTypeOrder?: "first" | "last" | "inline"; + /** + * Indicates where named type-only imports should sort. "inline" sorts named imports without regard to if the import is + * type-only. + * + * Default: `last` + */ + readonly organizeImportsTypeOrder?: OrganizeImportsTypeOrder; + /** + * Indicates whether to exclude standard library and node_modules file symbols from navTo results. + */ readonly excludeLibrarySymbolsInNavTo?: boolean; + readonly lazyConfiguredProjectsFromExternalProject?: boolean; + readonly displayPartsForJSDoc?: boolean; + readonly generateReturnInDocTemplate?: boolean; + readonly disableLineTextInReferences?: boolean; } + type OrganizeImportsTypeOrder = "last" | "inline" | "first"; /** Represents a bigint literal value without requiring bigint support */ interface PseudoBigInt { negative: boolean; @@ -9184,10 +8648,6 @@ declare namespace ts { function isNonNullChain(node: Node): node is NonNullChain; function isBreakOrContinueStatement(node: Node): node is BreakOrContinueStatement; function isNamedExportBindings(node: Node): node is NamedExportBindings; - /** @deprecated */ - function isUnparsedTextLike(node: Node): node is UnparsedTextLike; - /** @deprecated */ - function isUnparsedNode(node: Node): node is UnparsedNode; function isJSDocPropertyLikeTag(node: Node): node is JSDocPropertyLikeTag; /** * True if kind is of some token syntax kind. @@ -9295,18 +8755,6 @@ declare namespace ts { * ``` */ function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[]; - /** @deprecated */ - function createUnparsedSourceFile(text: string): UnparsedSource; - /** @deprecated */ - function createUnparsedSourceFile(inputFile: InputFiles, type: "js" | "dts", stripInternal?: boolean): UnparsedSource; - /** @deprecated */ - function createUnparsedSourceFile(text: string, mapPath: string | undefined, map: string | undefined): UnparsedSource; - /** @deprecated */ - function createInputFiles(javascriptText: string, declarationText: string): InputFiles; - /** @deprecated */ - function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles; - /** @deprecated */ - function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined, buildInfoPath: string | undefined): InputFiles; /** * Create an external source map source file reference */ @@ -9551,12 +8999,8 @@ declare namespace ts { function isShorthandPropertyAssignment(node: Node): node is ShorthandPropertyAssignment; function isSpreadAssignment(node: Node): node is SpreadAssignment; function isEnumMember(node: Node): node is EnumMember; - /** @deprecated */ - function isUnparsedPrepend(node: Node): node is UnparsedPrepend; function isSourceFile(node: Node): node is SourceFile; function isBundle(node: Node): node is Bundle; - /** @deprecated */ - function isUnparsedSource(node: Node): node is UnparsedSource; function isJSDocTypeExpression(node: Node): node is JSDocTypeExpression; function isJSDocNameReference(node: Node): node is JSDocNameReference; function isJSDocMemberName(node: Node): node is JSDocMemberName; @@ -9598,6 +9042,7 @@ declare namespace ts { function isJSDocImplementsTag(node: Node): node is JSDocImplementsTag; function isJSDocSatisfiesTag(node: Node): node is JSDocSatisfiesTag; function isJSDocThrowsTag(node: Node): node is JSDocThrowsTag; + function isJSDocImportTag(node: Node): node is JSDocImportTag; function isQuestionOrExclamationToken(node: Node): node is QuestionToken | ExclamationToken; function isIdentifierOrThisTypeNode(node: Node): node is Identifier | ThisTypeNode; function isReadonlyKeywordOrPlusOrMinusToken(node: Node): node is ReadonlyKeyword | PlusToken | MinusToken; @@ -10035,6 +9480,7 @@ declare namespace ts { interface EmitOutput { outputFiles: OutputFile[]; emitSkipped: boolean; + diagnostics: readonly Diagnostic[]; } interface OutputFile { name: string; @@ -10375,8 +9821,7 @@ declare namespace ts { } enum InvalidatedProjectKind { Build = 0, - /** @deprecated */ UpdateBundle = 1, - UpdateOutputFileStamps = 2, + UpdateOutputFileStamps = 1, } interface InvalidatedProjectBase { readonly kind: InvalidatedProjectKind; @@ -10407,20 +9852,7 @@ declare namespace ts { getSemanticDiagnosticsOfNextAffectedFile(cancellationToken?: CancellationToken, ignoreSourceFile?: (sourceFile: SourceFile) => boolean): AffectedFileResult<readonly Diagnostic[]>; emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult | undefined; } - /** @deprecated */ - interface UpdateBundleProject<T extends BuilderProgram> extends InvalidatedProjectBase { - readonly kind: InvalidatedProjectKind.UpdateBundle; - emit(writeFile?: WriteFileCallback, customTransformers?: CustomTransformers): EmitResult | BuildInvalidedProject<T> | undefined; - } - type InvalidatedProject<T extends BuilderProgram> = UpdateOutputFileStampsProject | BuildInvalidedProject<T> | UpdateBundleProject<T>; - namespace JsTyping { - interface TypingResolutionHost { - directoryExists(path: string): boolean; - fileExists(fileName: string): boolean; - readFile(path: string, encoding?: string): string | undefined; - readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[]; - } - } + type InvalidatedProject<T extends BuilderProgram> = UpdateOutputFileStampsProject | BuildInvalidedProject<T>; function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatCodeSettings; /** * Represents an immutable snapshot of a script at a specified time.Once acquired, the @@ -10695,6 +10127,7 @@ declare namespace ts { uncommentSelection(fileName: string, textRange: TextRange): TextChange[]; getSupportedCodeFixes(fileName?: string): readonly string[]; dispose(): void; + getPasteEdits(args: PasteEditsArgs, formatOptions: FormatCodeSettings): PasteEdits; } interface JsxClosingTagInfo { readonly newText: string; @@ -10712,6 +10145,20 @@ declare namespace ts { SortAndCombine = "SortAndCombine", RemoveUnused = "RemoveUnused", } + interface PasteEdits { + edits: readonly FileTextChanges[]; + fixId?: {}; + } + interface PasteEditsArgs { + targetFile: string; + pastedText: string[]; + pasteLocations: TextRange[]; + copiedFrom: { + file: string; + range: TextRange[]; + } | undefined; + preferences: UserPreferences; + } interface OrganizeImportsArgs extends CombinedCodeFixScope { /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; @@ -10967,6 +10414,19 @@ declare namespace ts { * when calling `getEditsForRefactor`. */ isInteractive?: boolean; + /** + * Range of code the refactoring will be applied to. + */ + range?: { + start: { + line: number; + offset: number; + }; + end: { + line: number; + offset: number; + }; + }; } /** * A set of edits to make in response to a refactor action, plus an optional @@ -11155,7 +10615,13 @@ declare namespace ts { linkText = 24, } interface SymbolDisplayPart { + /** + * Text of an item describing the symbol. + */ text: string; + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; } interface JSDocLinkDisplayPart extends SymbolDisplayPart { @@ -11207,6 +10673,9 @@ declare namespace ts { interface InteractiveRefactorArguments { targetFile: string; } + /** + * Signature help information for a single parameter + */ interface SignatureHelpParameter { name: string; documentation: SymbolDisplayPart[]; @@ -11301,9 +10770,25 @@ declare namespace ts { name: string; kind: ScriptElementKind; kindModifiers?: string; + /** + * A string that is used for comparing completion items so that they can be ordered. This + * is often the same as the name but may be different in certain circumstances. + */ sortText: string; + /** + * Text to insert instead of `name`. + * This is used to support bracketed completions; If `name` might be "a-b" but `insertText` would be `["a-b"]`, + * coupled with `replacementSpan` to replace a dotted access with a bracket access. + */ insertText?: string; + /** + * A string that should be used when filtering a set of + * completion items. + */ filterText?: string; + /** + * `insertText` should be interpreted as a snippet if true. + */ isSnippet?: true; /** * An optional span that indicates the text to be replaced by this completion item. @@ -11311,13 +10796,43 @@ declare namespace ts { * It will be set if the required span differs from the one generated by the default replacement behavior. */ replacementSpan?: TextSpan; + /** + * Indicates whether commiting this completion entry will require additional code actions to be + * made to avoid errors. The CompletionEntryDetails will have these actions. + */ hasAction?: true; + /** + * Identifier (not necessarily human-readable) identifying where this completion came from. + */ source?: string; + /** + * Human-readable description of the `source`. + */ sourceDisplay?: SymbolDisplayPart[]; + /** + * Additional details for the label. + */ labelDetails?: CompletionEntryLabelDetails; + /** + * If true, this completion should be highlighted as recommended. There will only be one of these. + * This will be set when we know the user should write an expression with a certain type and that type is an enum or constructable class. + * Then either that enum/class or a namespace containing it will be the recommended symbol. + */ isRecommended?: true; + /** + * If true, this completion was generated from traversing the name table of an unchecked JS file, + * and therefore may not be accurate. + */ isFromUncheckedFile?: true; + /** + * If true, this completion was for an auto-import of a module not yet in the program, but listed + * in the project package.json. Used for telemetry reporting. + */ isPackageJsonImport?: true; + /** + * If true, this completion was an auto-import-style completion of an import statement (i.e., the + * module specifier was inserted along with the imported identifier). Used for telemetry reporting. + */ isImportStatementCompletion?: true; /** * For API purposes. @@ -11336,7 +10851,17 @@ declare namespace ts { data?: CompletionEntryData; } interface CompletionEntryLabelDetails { + /** + * An optional string which is rendered less prominently directly after + * {@link CompletionEntry.name name}, without any spacing. Should be + * used for function signatures or type annotations. + */ detail?: string; + /** + * An optional string which is rendered less prominently after + * {@link CompletionEntryLabelDetails.detail}. Should be used for fully qualified + * names or file path. + */ description?: string; } interface CompletionEntryDetails { @@ -11705,6 +11230,7 @@ declare namespace ts { }; function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo; function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; + function transpileDeclaration(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; interface TranspileOptions { compilerOptions?: CompilerOptions; |